mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix aws_s3 connection exception handling (#30955)
`ProfileNotFound` does not have a `response` attribute, and `NoCredentialsError` does not occur at connection creation time.
This commit is contained in:
parent
90dd698b86
commit
371c6dba8b
1 changed files with 2 additions and 3 deletions
|
@ -609,9 +609,8 @@ def main():
|
||||||
aws_connect_kwargs.pop(key, None)
|
aws_connect_kwargs.pop(key, None)
|
||||||
try:
|
try:
|
||||||
s3 = get_s3_connection(module, aws_connect_kwargs, location, rgw, s3_url)
|
s3 = get_s3_connection(module, aws_connect_kwargs, location, rgw, s3_url)
|
||||||
except (botocore.exceptions.NoCredentialsError, botocore.exceptions.ProfileNotFound) as e:
|
except botocore.exceptions.ProfileNotFound as e:
|
||||||
module.fail_json(msg="Can't authorize connection. Check your credentials and profile.",
|
module.fail_json(msg=to_native(e))
|
||||||
exceptions=traceback.format_exc(), **camel_dict_to_snake_dict(e.response))
|
|
||||||
|
|
||||||
validate = not ignore_nonexistent_bucket
|
validate = not ignore_nonexistent_bucket
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue