summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorrandyl <r.levensalor@cablelabs.com>2017-03-29 14:31:52 -0600
committerrandyl <r.levensalor@cablelabs.com>2017-03-29 14:31:52 -0600
commitb3106eca334e09501cd62739157ae805ee76ff6c (patch)
tree148e66b744fc763862a88def7d0326ddf752e980 /examples
parentc75f6807b6f2182b9a093407a5ed97bd79e81245 (diff)
Fixed cleanup after failed deploy
Added exception handling when performing a cleanup after a failed deploy. This is a temporay fix, that will not impact FuncTest. Router and network clean calls will eventually need to be updated. JIRA : SNAPS-55 Change-Id: I24d79802f02357015ada20726e170dd5128754f1 Signed-off-by: randyl <r.levensalor@cablelabs.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/launch.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/examples/launch.py b/examples/launch.py
index 5f2e999..6ddfe3b 100644
--- a/examples/launch.py
+++ b/examples/launch.py
@@ -246,7 +246,7 @@ def __create_instances(os_conn_config, instances_config, image_dict, keypairs_di
raise e
logger.info('Created configured instances')
-
+ # TODO Should there be an error if there isn't an instances config
return vm_dict
@@ -525,7 +525,7 @@ def main(arguments):
logger.info('Starting to Deploy')
config = file_utils.read_yaml(arguments.environment)
- logger.info('Read configuration file - ' + arguments.environment)
+ logger.debug('Read configuration file - ' + arguments.environment)
if config:
os_config = config.get('openstack')
@@ -542,7 +542,7 @@ def main(arguments):
# Create flavors
flavor_dict = __create_flavors(os_conn_config, os_config.get('flavors'),
- arguments.clean is not ARG_NOT_SET)
+ arguments.clean is not ARG_NOT_SET)
# Create images
image_dict = __create_images(os_conn_config, os_config.get('images'),
@@ -569,7 +569,6 @@ def main(arguments):
__cleanup(vm_dict, keypairs_dict, router_dict, network_dict, image_dict, flavor_dict, True)
raise e
-
# Must enter either block
if arguments.clean is not ARG_NOT_SET:
# Cleanup Environment
@@ -600,9 +599,15 @@ def __cleanup(vm_dict, keypairs_dict, router_dict, network_dict, image_dict, fla
for key, kp_inst in keypairs_dict.iteritems():
kp_inst.clean()
for key, router_inst in router_dict.iteritems():
- router_inst.clean()
+ try:
+ router_inst.clean()
+ except Exception:
+ logger.warning("Router not found continuing to next component")
for key, net_inst in network_dict.iteritems():
- net_inst.clean()
+ try:
+ net_inst.clean()
+ except Exception:
+ logger.warning("Network not found continuing to next component")
if clean_image:
for key, image_inst in image_dict.iteritems():
image_inst.clean()