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

Catch the raised exception so we can report failure #42177

Merged
merged 1 commit into from
Jul 2, 2018

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Jul 2, 2018

Just like #42072

Avoid the undefined name by catching the raised exception into the variable e so it can be reported on the following line.

flake8 testing of https://github.com/ansible/ansible on Python 3.6.3

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./lib/ansible/modules/cloud/amazon/iam_policy.py:305:16: F821 undefined name 'e'
            if e.errno == 2:
               ^
./lib/ansible/modules/cloud/misc/rhevm.py:594:24: F821 undefined name 'e'
            setMsg(str(e))
                       ^
./lib/ansible/modules/files/archive.py:391:92: F821 undefined name 'e'
                module.fail_json(dest=dest, msg='Error deleting some source files: ' + str(e), files=errors)
                                                                                           ^
3    F821 undefined name 'e'
3
SUMMARY
ISSUE TYPE
  • Feature Pull Request
  • New Module Pull Request
  • Bugfix Pull Request
  • Docs Pull Request
COMPONENT NAME
ANSIBLE VERSION

ADDITIONAL INFORMATION

@ansibot
Copy link
Contributor

ansibot commented Jul 2, 2018

@cclauss This PR contains @ mentions in at least one commit message. Those mentions can cause cascading notifications through GitHub and need to be removed. Please squash or amend your commits to remove the mentions.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Jul 2, 2018

cc @defionscode
click here for bot help

@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 aws cloud feature This issue/PR relates to a feature request. module This issue/PR relates to a module. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. needs_triage Needs a first human triage before being processed. small_patch support:community This issue/PR relates to code supported by the Ansible community. labels Jul 2, 2018
@Akasurde
Copy link
Member

Akasurde commented Jul 2, 2018

@cclauss Could you please address this - #42177 (comment) ? Thanks.

@Akasurde Akasurde removed the needs_triage Needs a first human triage before being processed. label Jul 2, 2018
Just like ansible#42072

Avoid the _undefined name_ by catching the raised exception into the variable __e__ so it can be reported on the following line.

flake8 testing of https://github.com/ansible/ansible on Python 3.6.3

$ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__
```
./lib/ansible/modules/cloud/amazon/iam_policy.py:305:16: F821 undefined name 'e'
            if e.errno == 2:
               ^
./lib/ansible/modules/cloud/misc/rhevm.py:594:24: F821 undefined name 'e'
            setMsg(str(e))
                       ^
./lib/ansible/modules/files/archive.py:391:92: F821 undefined name 'e'
                module.fail_json(dest=dest, msg='Error deleting some source files: ' + str(e), files=errors)
                                                                                           ^
3    F821 undefined name 'e'
3
```
@cclauss
Copy link
Contributor Author

cclauss commented Jul 2, 2018

@Akasurde Addressed.

Copy link
Member

@Akasurde Akasurde left a comment

Choose a reason for hiding this comment

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

LGTM

@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jul 2, 2018
@s-hertel s-hertel merged commit 14bc625 into ansible:devel Jul 2, 2018
@cclauss cclauss deleted the patch-5 branch July 2, 2018 12:46
@ansible ansible locked and limited conversation to collaborators Jul 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 aws cloud community_review In order to be merged, this PR must follow the community review workflow. feature This issue/PR relates to a feature request. module This issue/PR relates to a module. small_patch 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