Fixing compile time error exception handling for python 3. (#3843)
This commit is contained in:
parent
e2dbd0f445
commit
c3aab8ddcf
3 changed files with 5 additions and 5 deletions
|
@ -317,7 +317,7 @@ def core(module):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_token = module.params['api_token'] or os.environ['DO_API_TOKEN'] or os.environ['DO_API_KEY']
|
api_token = module.params['api_token'] or os.environ['DO_API_TOKEN'] or os.environ['DO_API_KEY']
|
||||||
except KeyError, e:
|
except KeyError as e:
|
||||||
module.fail_json(msg='Unable to load %s' % e.message)
|
module.fail_json(msg='Unable to load %s' % e.message)
|
||||||
|
|
||||||
changed = True
|
changed = True
|
||||||
|
@ -433,9 +433,9 @@ def main():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
core(module)
|
core(module)
|
||||||
except TimeoutError, e:
|
except TimeoutError as e:
|
||||||
module.fail_json(msg=str(e), id=e.id)
|
module.fail_json(msg=str(e), id=e.id)
|
||||||
except (DoError, Exception), e:
|
except (DoError, Exception) as e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
||||||
# import module snippets
|
# import module snippets
|
||||||
|
|
|
@ -174,7 +174,7 @@ def core(module):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api_token = module.params['api_token'] or os.environ['DO_API_TOKEN'] or os.environ['DO_API_KEY']
|
api_token = module.params['api_token'] or os.environ['DO_API_TOKEN'] or os.environ['DO_API_KEY']
|
||||||
except KeyError, e:
|
except KeyError as e:
|
||||||
module.fail_json(msg='Unable to load %s' % e.message)
|
module.fail_json(msg='Unable to load %s' % e.message)
|
||||||
|
|
||||||
changed = True
|
changed = True
|
||||||
|
|
|
@ -132,7 +132,7 @@ def core(module):
|
||||||
# params['client_id'] will be None even if client_id is not passed in
|
# params['client_id'] will be None even if client_id is not passed in
|
||||||
client_id = module.params['client_id'] or os.environ['DO_CLIENT_ID']
|
client_id = module.params['client_id'] or os.environ['DO_CLIENT_ID']
|
||||||
api_key = module.params['api_key'] or os.environ['DO_API_KEY']
|
api_key = module.params['api_key'] or os.environ['DO_API_KEY']
|
||||||
except KeyError, e:
|
except KeyError as e:
|
||||||
module.fail_json(msg='Unable to load %s' % e.message)
|
module.fail_json(msg='Unable to load %s' % e.message)
|
||||||
|
|
||||||
changed = True
|
changed = True
|
||||||
|
|
Loading…
Reference in a new issue