no change - various tweaks here and there
Thierry Parmentelat [Wed, 3 Jun 2015 14:14:38 +0000 (16:14 +0200)]
sfa/client/sfi.py
sfa/methods/Describe.py
sfa/planetlab/plaggregate.py
sfa/rspecs/elements/element.py
sfa/rspecs/elements/versions/pgv2SliverType.py
sfa/rspecs/versions/pgv2.py

index 2a3e21f..8615e1a 100644 (file)
@@ -496,9 +496,9 @@ class Sfi:
             #panos: a new option to define the type of information about resources a user is interested in
             parser.add_option("-i", "--info", dest="info",
                                 help="optional component information", default=None)
-            # a new option to retreive or not reservation-oriented RSpecs (leases)
+            # a new option to retrieve or not reservation-oriented RSpecs (leases)
             parser.add_option("-l", "--list_leases", dest="list_leases", type="choice",
-                                help="Retreive or not reservation-oriented RSpecs ([resources]|leases|all )",
+                                help="Retrieve or not reservation-oriented RSpecs ([resources]|leases|all)",
                                 choices=("all", "resources", "leases"), default="resources")
 
 
index 018f803..ae198c0 100644 (file)
@@ -36,9 +36,10 @@ class Describe(Method):
                 options['geni_rspec_version'] = options['rspec_version']
             else:
                 raise SfaInvalidArgument('Must specify an rspec version option. geni_rspec_version cannot be null')
-        valid_creds = self.api.auth.checkCredentialsSpeaksFor(creds, 'listnodes', urns, 
-                                                              check_sliver_callback = self.api.driver.check_sliver_credentials,
-                                                              options=options)
+        valid_creds  = self.api.auth.checkCredentialsSpeaksFor(
+            creds, 'listnodes', urns, 
+            check_sliver_callback = self.api.driver.check_sliver_credentials,
+            options=options)
 
         # get hrn of the original caller 
         origin_hrn = options.get('origin_hrn', None)
index 6fabf79..7604758 100644 (file)
@@ -280,16 +280,16 @@ class PlAggregate:
         rspec_node['slivers'] = [rspec_sliver]
 
         # slivers always provide the ssh service
-        login = Login({'authentication': 'ssh-keys', 
-                       'hostname': sliver['hostname'], 
+        login = Login({'authentication': 'ssh-keys',
+                       'hostname': sliver['hostname'],
                        'port':'22', 
                        'username': sliver['name'],
                        'login': sliver['name']
                       })
         service = ServicesElement({'login': login,
-                            'services_user': sliver['services_user']})
-        rspec_node['services'] = [service]    
-        return rspec_node      
+                                   'services_user': sliver['services_user']})
+        rspec_node['services'] = [service]
+        return rspec_node
 
     def get_slice_tags(self, slice):
         slice_tag_ids = []
index 36ad12f..df46c89 100644 (file)
@@ -19,4 +19,5 @@ class Element(dict):
         elif hasattr(self.element, name):
             return getattr(self.element, name)
         else:
-            raise AttributeError, "class Element has no attribute %s" % name
+            raise AttributeError("class Element of type {} has no attribute {}"
+                                  .format(self.__class__.__name__, name))
index 3ad687f..ee9797a 100644 (file)
@@ -38,7 +38,7 @@ class PGv2SliverType:
                     attrib_elem = xml.add_element('{%s}info' % self.namespaces['flack'])
                     attrib_dict = eval(tag['value'])
                     for (key, value) in attrib_dict.items():
-                        attrib_elem.set(key, value)                
+                        attrib_elem.set(key, value)
     @staticmethod
     def get_slivers(xml, filter=None):
         if filter is None: filter={}
index 340e92e..01a3155 100644 (file)
@@ -24,7 +24,8 @@ class PGv2(RSpecVersion):
     # Networks
     def get_networks(self):
         network_names = set()
-        nodes = self.xml.xpath('//default:node[@component_manager_id] | //node[@component_manager_id]', namespaces=self.namespaces)
+        nodes = self.xml.xpath('//default:node[@component_manager_id] | //node[@component_manager_id]',
+                               namespaces=self.namespaces)
         for node in nodes:
             if 'component_manager_id' in node.attrib:
                 network_urn = node.get('component_manager_id')