From 038d03040415b876d71988938ac133eb9c29f909 Mon Sep 17 00:00:00 2001 From: Troy C Date: Mon, 16 Dec 2013 09:33:29 -0600 Subject: [PATCH] catch exposed cs.exceptions instead of novaclient --- library/cloud/rax | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/library/cloud/rax b/library/cloud/rax index 2b379081789..d67802ce1e0 100644 --- a/library/cloud/rax +++ b/library/cloud/rax @@ -162,8 +162,6 @@ except ImportError: print("failed=True msg='pyrax is required for this module'") sys.exit(1) -import novaclient.exceptions - ACTIVE_STATUSES = ('ACTIVE', 'BUILD', 'HARD_REBOOT', 'MIGRATING', 'PASSWORD', 'REBOOT', 'REBUILD', 'RESCUE', 'RESIZE', 'REVERT_RESIZE') FINAL_STATUSES = ('ACTIVE', 'ERROR') @@ -368,14 +366,12 @@ def cloudservers(module, state, name, flavor, image, meta, key_name, files, except ValueError: try: image = cs.images.find(human_id=image) - except (novaclient.exceptions.NotFound, - pyrax.exceptions.NotFound, - pyrax.exceptions.NoUniqueMatch): + except(cs.exceptions.NotFound, + cs.exceptions.NoUniqueMatch): try: image = cs.images.find(name=image) - except (novaclient.exceptions.NotFound, - pyrax.exceptions.NotFound, - pyrax.exceptions.NoUniqueMatch): + except (cs.exceptions.NotFound, + cs.exceptions.NoUniqueMatch): module.fail_json(msg='No matching image found (%s)' % image)