From fb2355e47d6567b497b083522e8228c1cb4b5be8 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Tue, 17 May 2016 02:30:25 +0200 Subject: [PATCH] Port rax.py to python3 compatible syntax (#15875) Since the pyrax website say that only python 2.7 is tested, I do not think it is worth to aim for python 2.4 compatibility for the various rackspace modules. --- lib/ansible/module_utils/rax.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/module_utils/rax.py b/lib/ansible/module_utils/rax.py index ad7afeb3ec..213a215556 100644 --- a/lib/ansible/module_utils/rax.py +++ b/lib/ansible/module_utils/rax.py @@ -163,7 +163,7 @@ def rax_find_volume(module, rax_module, name): volume = cbs.find(name=name) except rax_module.exc.NotFound: volume = None - except Exception, e: + except Exception as e: module.fail_json(msg='%s' % e) return volume @@ -302,7 +302,7 @@ def setup_rax_module(module, rax_module, region_required=True): os.environ.get('RAX_CREDS_FILE')) region = (region or os.environ.get('RAX_REGION') or rax_module.get_setting('region')) - except KeyError, e: + except KeyError as e: module.fail_json(msg='Unable to load %s' % e.message) try: @@ -317,7 +317,7 @@ def setup_rax_module(module, rax_module, region_required=True): rax_module.set_credential_file(credentials, region=region) else: raise Exception('No credentials supplied!') - except Exception, e: + except Exception as e: if e.message: msg = str(e.message) else: