summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorSteven Pisarski <s.pisarski@cablelabs.com>2017-10-16 13:40:35 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-10-16 13:40:35 +0000
commit8810b59c9a3a61013398bac256b84bbb365b4d87 (patch)
tree505a2641501c662f0cdbb219db8b6096ff6ddfb5 /examples
parentf53a90c63227c9faca8c8f7da6fa0dff48538662 (diff)
parent92d57dd388e5ad292d476298ad79d8a566780e2a (diff)
Merge "Improved creator/state machine classes class hierarchy."
Diffstat (limited to 'examples')
-rw-r--r--examples/launch.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/examples/launch.py b/examples/launch.py
index f5d3bea..76353a2 100644
--- a/examples/launch.py
+++ b/examples/launch.py
@@ -164,7 +164,11 @@ def __create_instances(os_creds_dict, creator_class, config_class, config,
creator = creator_class(
__get_creds(os_creds_dict, os_users_dict, inst_config),
config_class(**inst_config))
- creator.create(cleanup=cleanup)
+
+ if cleanup:
+ creator.initialize()
+ else:
+ creator.create()
out[inst_config['name']] = creator
logger.info('Created configured %s', config_key)
except Exception as e:
@@ -211,7 +215,7 @@ def __create_vm_instances(os_creds_dict, os_users_dict, instances_config,
instance_settings,
image_creator.image_settings,
keypair_creator=keypairs_dict[kp_name],
- cleanup=cleanup)
+ init_only=cleanup)
else:
raise Exception('Image creator instance not found.'
' Cannot instantiate')
@@ -669,7 +673,6 @@ def main(arguments):
logger.error(
'Unexpected error deploying environment. Rolling back due'
' to - ' + str(e))
- # __cleanup(creators)
raise
# Must enter either block
@@ -701,8 +704,8 @@ def main(arguments):
def __cleanup(creators, clean_image=False):
for creator_dict in reversed(creators):
for key, creator in creator_dict.items():
- if (isinstance(creator, OpenStackImage) and clean_image) or \
- not isinstance(creator, OpenStackImage):
+ if ((isinstance(creator, OpenStackImage) and clean_image)
+ or not isinstance(creator, OpenStackImage)):
try:
creator.clean()
except Exception as e: