X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=blobdiff_plain;f=sfa%2Fplanetlab%2Fplslices.py;h=3f6ef7d02e7499d05d2f125c17f375f5325e004d;hp=e868acd187251be8aa85563f85b24804a6ed5113;hb=4a9e6751f9f396f463932133b9d62fc925a99ef6;hpb=648ac3fd865ea29425485f26eb0a7bf1a62281e0 diff --git a/sfa/planetlab/plslices.py b/sfa/planetlab/plslices.py index e868acd1..3f6ef7d0 100644 --- a/sfa/planetlab/plslices.py +++ b/sfa/planetlab/plslices.py @@ -11,7 +11,7 @@ from sfa.planetlab.plxrn import (PlXrn, hrn_to_pl_slicename, xrn_to_hostname, top_auth, hash_loginbase) from sfa.storage.model import SliverAllocation -MAXINT = 2L**31 - 1 +MAXINT = 2**31 - 1 class PlSlices: @@ -51,7 +51,7 @@ class PlSlices: # Build up list of keys key_ids = set() - for person in all_persons.values(): + for person in list(all_persons.values()): key_ids.update(person['key_ids']) key_ids = list(key_ids) # Get user account keys @@ -92,17 +92,13 @@ class PlSlices: sliver_attributes = [] if node is not None: - for sliver_attribute in filter( - lambda a: a['node_id'] == node['node_id'], - slice_tags): + for sliver_attribute in [a for a in slice_tags if a['node_id'] == node['node_id']]: sliver_attributes.append(sliver_attribute['tagname']) attributes.append({'tagname': sliver_attribute['tagname'], 'value': sliver_attribute['value']}) # set nodegroup slice attributes - for slice_tag in filter( - lambda a: a['nodegroup_id'] in node['nodegroup_ids'], - slice_tags): + for slice_tag in [a for a in slice_tags if a['nodegroup_id'] in node['nodegroup_ids']]: # Do not set any nodegroup slice attributes for # which there is at least one sliver attribute # already set. @@ -110,9 +106,7 @@ class PlSlices: attributes.append({'tagname': slice_tag['tagname'], 'value': slice_tag['value']}) - for slice_tag in filter( - lambda a: a['node_id'] is None, - slice_tags): + for slice_tag in [a for a in slice_tags if a['node_id'] is None]: # Do not set any global slice attributes for # which there is at least one sliver attribute # already set. @@ -237,7 +231,7 @@ class PlSlices: current_slivers = [node['hostname'] for node in nodes] # remove nodes not in rspec - deleted_nodes = list(set(current_slivers).difference(slivers.keys())) + deleted_nodes = list(set(current_slivers).difference(list(slivers.keys()))) # add nodes from rspec added_nodes = list(set(slivers.keys()).difference(current_slivers))