Commit 45d6d6fd authored by Loic Baron's avatar Loic Baron
Browse files

bug fix model.slice initial_testbeds

parent f43e3193
......@@ -19,9 +19,10 @@ class Slice(Entity):
data['geni_users'] = data.get('geni_users', [])
data['resources'] = data.get('resources', [])
data['testbeds'] = data.get('testbeds', [])
data['initial_testbeds'] = data.get('initial_testbeds', [])
for r in data['resources']:
data['testbeds'].append(r['testbed'])
data['initial_testbeds'] = data['testbeds']
if r['testbed'] not in data['initial_testbeds']:
data['initial_testbeds'].append(r['testbed'])
data['leases'] = data.get('leases', [])
data['run_am'] = data.get('run_am', False)
super().__init__(data)
......@@ -58,7 +59,8 @@ class Slice(Entity):
def addResource(self, resource):
self.appendAttribute('resources', resource.getAttributes())
self.appendAttribute('testbeds', resource.getAttribute('testbed'))
if resource.getAttribute('testbed') not in self.getAttribute('testbeds'):
self.appendAttribute('testbeds', resource.getAttribute('testbed'))
self.setAttribute('run_am', True)
return self
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment