diff --git a/lib/ansible/modules/cloud/digital_ocean/digital_ocean.py b/lib/ansible/modules/cloud/digital_ocean/digital_ocean.py index 19a39d848d..0f5af9b9bc 100644 --- a/lib/ansible/modules/cloud/digital_ocean/digital_ocean.py +++ b/lib/ansible/modules/cloud/digital_ocean/digital_ocean.py @@ -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 diff --git a/lib/ansible/modules/cloud/digital_ocean/digital_ocean_domain.py b/lib/ansible/modules/cloud/digital_ocean/digital_ocean_domain.py index e83ac86bcd..81de784af8 100644 --- a/lib/ansible/modules/cloud/digital_ocean/digital_ocean_domain.py +++ b/lib/ansible/modules/cloud/digital_ocean/digital_ocean_domain.py @@ -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 diff --git a/lib/ansible/modules/cloud/digital_ocean/digital_ocean_sshkey.py b/lib/ansible/modules/cloud/digital_ocean/digital_ocean_sshkey.py index cf01ae7be6..25f3b1ef7d 100644 --- a/lib/ansible/modules/cloud/digital_ocean/digital_ocean_sshkey.py +++ b/lib/ansible/modules/cloud/digital_ocean/digital_ocean_sshkey.py @@ -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