Fixing compile time error exception handling for python 3. (#3843)

This commit is contained in:
@ 2016-06-02 14:51:35 -07:00 committed by Matt Clay
parent e2dbd0f445
commit c3aab8ddcf
3 changed files with 5 additions and 5 deletions

View file

@ -317,7 +317,7 @@ def core(module):
try:
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)
changed = True
@ -433,9 +433,9 @@ def main():
try:
core(module)
except TimeoutError, e:
except TimeoutError as e:
module.fail_json(msg=str(e), id=e.id)
except (DoError, Exception), e:
except (DoError, Exception) as e:
module.fail_json(msg=str(e))
# import module snippets

View file

@ -174,7 +174,7 @@ def core(module):
try:
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)
changed = True

View file

@ -132,7 +132,7 @@ def core(module):
# 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']
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)
changed = True