Commit a141a2f8 authored by Vincent Pelletier's avatar Vincent Pelletier

Avoid accessing the same key on each iteration.

parent 9fdf6765
...@@ -73,12 +73,13 @@ class SlapOSControler(object): ...@@ -73,12 +73,13 @@ class SlapOSControler(object):
shutil.rmtree(software_root) shutil.rmtree(software_root)
os.mkdir(software_root) os.mkdir(software_root)
os.chmod(software_root, 0750) os.chmod(software_root, 0750)
instance_root = config['instance_root']
for i in range(0, MAX_PARTIONS): for i in range(0, MAX_PARTIONS):
# create partition and configure computer # create partition and configure computer
# XXX: at the moment all partitions do share same virtual interface address # XXX: at the moment all partitions do share same virtual interface address
# this is not a problem as usually all services are on different ports # this is not a problem as usually all services are on different ports
partition_reference = '%s-%s' %(config['partition_reference'], i) partition_reference = '%s-%s' %(config['partition_reference'], i)
partition_path = os.path.join(config['instance_root'], partition_reference) partition_path = os.path.join(instance_root, partition_reference)
if os.path.exists(partition_path): if os.path.exists(partition_path):
# delete old paritions which may exists in order to not get its data (ex. MySQL db content) # delete old paritions which may exists in order to not get its data (ex. MySQL db content)
# from previous testnode's runs # from previous testnode's runs
...@@ -87,7 +88,7 @@ class SlapOSControler(object): ...@@ -87,7 +88,7 @@ class SlapOSControler(object):
os.chmod(partition_path, 0750) os.chmod(partition_path, 0750)
computer.updateConfiguration(xml_marshaller.xml_marshaller.dumps({ computer.updateConfiguration(xml_marshaller.xml_marshaller.dumps({
'address': config['ipv4_address'], 'address': config['ipv4_address'],
'instance_root': config['instance_root'], 'instance_root': instance_root,
'netmask': '255.255.255.255', 'netmask': '255.255.255.255',
'partition_list': [{'address_list': [{'addr': config['ipv4_address'], 'partition_list': [{'address_list': [{'addr': config['ipv4_address'],
'netmask': '255.255.255.255'}, 'netmask': '255.255.255.255'},
......
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