applied the except and raise fixers to the master branch to close the gap with py3
[nepi.git] / src / nepi / util / sfarspec_proc.py
index d8bb27b..f8c8bb2 100644 (file)
@@ -3,9 +3,8 @@
 #    Copyright (C) 2013 INRIA
 #
 #    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation, either version 3 of the License, or
-#    (at your option) any later version.
+#    it under the terms of the GNU General Public License version 2 as
+#    published by the Free Software Foundation;
 #
 #    This program is distributed in the hope that it will be useful,
 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -67,19 +66,19 @@ class SfaRSpecProcessing(object):
         
         try:
             nodes = rspec.version.get_nodes()
-        except Exception, e:
+        except Exception as e:
             self._log.warn("Could not retrieve nodes in RSpec: %s" % e)
         try:
             leases = rspec.version.get_leases()
-        except Exception, e:
+        except Exception as e:
             self._log.warn("Could not retrieve leases in RSpec: %s" % e)
         try:
             links = rspec.version.get_links()
-        except Exception, e:
+        except Exception as e:
             self._log.warn("Could not retrieve links in RSpec: %s" % e)
         try:
             channels = rspec.version.get_channels()
-        except Exception, e:
+        except Exception as e:
             self._log.warn("Could not retrieve channels in RSpec: %s" % e)
   
         resources = [] 
@@ -168,7 +167,6 @@ class SfaRSpecProcessing(object):
             # TODO: take into account the case where we send a dict of URNs without keys
             #resource['component_id'] = resource.pop('urn')
             resource['component_id'] = urn
-            print resource['component_id']
             resource_hrn, resource_type = urn_to_hrn(resource['component_id'])
             # build component_manager_id
             top_auth = resource_hrn.split('.')[0]
@@ -199,7 +197,7 @@ class SfaRSpecProcessing(object):
             elif resource_type == 'channel':
                 channels.append(resource)
             else:
-                raise Exception, "Not supported type of resource" 
+                raise Exception("Not supported type of resource") 
         
         rspec.version.add_nodes(nodes, rspec_content_type="request")
         #rspec.version.add_leases(leases)
@@ -214,8 +212,8 @@ class SfaRSpecProcessing(object):
             for i, n in enumerate(b):
                 if 'sliver_type name="raw-pc"' in n:
                     b[i] = '<sliver_type name="raw-pc">'
-                    #b.insert(i+1, '<disk_image name="urn:publicid:IDN+wall2.ilabt.iminds.be+image+emulab-ops//%s"/>' % properties['disk_image'])
-                    b.insert(i+1, '<disk_image name="urn:publicid:IDN+wilab2.ilabt.iminds.be+image+nepi:%s"/>' % properties['disk_image'])
+                    b.insert(i+1, '<disk_image name="urn:publicid:IDN+wall2.ilabt.iminds.be+image+emulab-ops//%s"/>' % properties['disk_image'])
+                    #b.insert(i+1, '<disk_image name="urn:publicid:IDN+wilab2.ilabt.iminds.be+image+nepi:%s"/>' % properties['disk_image'])
                     b.insert(i+2, '</sliver_type>')
             string = ''.join(b)
         self._log.debug("request rspec : %s" % string)