Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ec2_snapshot_copy: WaitError and ClientError exception handling #38072

Merged
merged 1 commit into from
Apr 3, 2018

Conversation

ZuZuD
Copy link
Contributor

@ZuZuD ZuZuD commented Mar 28, 2018

SUMMARY

Fix issue #37834 - Error while raising WaitError exception in copy_snapshot() ('reason' is not a valid attribute)

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

ec2_snapshot_copy

ANSIBLE VERSION

ansible 2.4.2.0

ADDITIONAL INFORMATION
>>> from botocore.exceptions import WaiterError
>>> dir(WaiterError)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__',
 '__getitem__', '__getslice__', '__hash__', '__init__', '__module__', '__new__',
 '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__',
 '__str__', '__subclasshook__', '__unicode__', '__weakref__', 'args', 'fmt',  'message']

@ansibot
Copy link
Contributor

ansibot commented Mar 28, 2018

@ansibot ansibot added aws bug This issue/PR relates to a bug. cloud community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. support:community This issue/PR relates to code supported by the Ansible community. labels Mar 28, 2018
@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Mar 29, 2018
@@ -143,7 +143,7 @@ def copy_snapshot(module, ec2):
)

except WaiterError as we:
module.fail_json(msg='An error occurred (%s) waiting for the snapshot to become available. (%s)' % (we.message, we.reason))
module.fail_json(msg='An error occurred waiting for the snapshot to become available. (%s)' % str(we), exception=traceback.format_exc())
except ClientError as ce:
module.fail_json(msg=ce.message, exception=traceback.format_exc(), **camel_dict_to_snake_dict(ce.response))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this. Do you mind fixing this one as well? ce.message won't exist on python3.
module.fail_json(msg=str(ce), exception=traceback.format_exc(), **camel_dict_to_snake_dict(ce.response))

@ZuZuD ZuZuD changed the title ec2_snapshot_copy: WaitError exception handling ec2_snapshot_copy: WaitError and ClientError exception handling Apr 2, 2018
@ZuZuD
Copy link
Contributor Author

ZuZuD commented Apr 2, 2018

That's updated @s-hertel

@willthames willthames merged commit 70bcc5e into ansible:devel Apr 3, 2018
@willthames
Copy link
Contributor

Merged, thanks @ZuZuD

ilicmilan pushed a commit to ilicmilan/ansible that referenced this pull request Nov 7, 2018
ilicmilan pushed a commit to ilicmilan/ansible that referenced this pull request Nov 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
aws bug This issue/PR relates to a bug. cloud community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. new_contributor This PR is the first contribution by a new community member. support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants