Skip to content

Commit

Permalink
Fix aws_s3 connection exception handling (ansible#30955)
Browse files Browse the repository at this point in the history
`ProfileNotFound` does not have a `response` attribute, and
`NoCredentialsError` does not occur at connection creation time.
  • Loading branch information
willthames authored and s-hertel committed Sep 28, 2017
1 parent 90dd698 commit 371c6db
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/ansible/modules/cloud/amazon/aws_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,9 +609,8 @@ def main():
aws_connect_kwargs.pop(key, None)
try:
s3 = get_s3_connection(module, aws_connect_kwargs, location, rgw, s3_url)
except (botocore.exceptions.NoCredentialsError, botocore.exceptions.ProfileNotFound) as e:
module.fail_json(msg="Can't authorize connection. Check your credentials and profile.",
exceptions=traceback.format_exc(), **camel_dict_to_snake_dict(e.response))
except botocore.exceptions.ProfileNotFound as e:
module.fail_json(msg=to_native(e))

validate = not ignore_nonexistent_bucket

Expand Down

0 comments on commit 371c6db

Please sign in to comment.