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

network.py:ActionModule:run: does not honor _handle_src_option failures #52745

Merged
merged 4 commits into from
Feb 28, 2019

Conversation

chrisvanheuveln
Copy link
Contributor

SUMMARY

PR #50301 moved template error handling out of run() and into its own method in handle_src_option; however, after the change run() ignores the return value so any errors are ignored.

My fix looks for error state and returns it if present. Verified fix with nxos_config/tests/common/src_* tests.

Ref:
71113ee#diff-7477bf046013758366cc85b06f90709aR43

Also updated the src_basic.yaml test which didn't actually test with src: before.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

plugins/action/network

ADDITIONAL INFORMATION

Reproduceable with nxos_config/tests/common/src_invalid.yaml. The symptom is that the src: string fails the template handling (as expected) but the string is sent to the device anyway.

From src_invalid.yaml:

- name: configure with invalid src
  nxos_config:
    src: basic/foobar.j2
    provider: "{{ connection }}"
  register: result
  ignore_errors: yes

Test output:

    "msg": "basic/foobar.j2\r\r\n                   ^\r\n% Invalid command at '^' marker.\r\n\rn9k-109(config)# "
...
fatal: [n9k-109.cisco.com]: FAILED! => {
    "assertion": "result.msg == 'path specified in src not found'",
    "changed": false,
    "evaluated_to": false,
    "msg": "Assertion failed"

@chrisvanheuveln chrisvanheuveln changed the title template handler _handle_src_option does not honor failures etwork.py:ActionModule:run: does not honor _handle_src_option failures Feb 21, 2019
@chrisvanheuveln chrisvanheuveln changed the title etwork.py:ActionModule:run: does not honor _handle_src_option failures network.py:ActionModule:run: does not honor _handle_src_option failures Feb 21, 2019
@chrisvanheuveln
Copy link
Contributor Author

@mikewiebe

@ansibot
Copy link
Contributor

ansibot commented Feb 21, 2019

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. needs_triage Needs a first human triage before being processed. networking Network category new_contributor This PR is the first contribution by a new community member. nxos Cisco NXOS community small_patch support:network This issue/PR relates to code supported by the Ansible Network Team. test This PR relates to tests. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Feb 21, 2019
@dagwieers dagwieers added the cisco Cisco technologies label Feb 22, 2019
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed needs_triage Needs a first human triage before being processed. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Feb 22, 2019
Copy link
Member

@ganeshrn ganeshrn left a comment

Choose a reason for hiding this comment

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

The issue is similar to #52911 which is fixed by PR #52912
However, the changes in integration test are still valid. Can you please revert the changes to file plugins/action/network.py as it not required after PR #52912 is merged

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. new_contributor This PR is the first contribution by a new community member. labels Feb 27, 2019
@ansibot
Copy link
Contributor

ansibot commented Feb 27, 2019

@chrisvanheuveln this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibot ansibot added merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html and removed small_patch labels Feb 27, 2019
@ansibot
Copy link
Contributor

ansibot commented Feb 27, 2019

@chrisvanheuveln this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

PR ansible#50301 moved template error handling out of run() and into its
own method in `_handle_src_option`; however, after the change run()
ignores the return value so any errors are ignored.

Reproduceable with `nxos_config/tests/common/src_invalid.yaml`

Verified fix with `nxos_config/tests/common/src_*` tests.

Ref:
ansible@71113ee#diff-7477bf046013758366cc85b06f90709aR43
This test was not actually testing with `src:` as it should have.
@chrisvanheuveln
Copy link
Contributor Author

Can you please revert the changes to file plugins/action/network.py as it not required after PR #52912 is merged

@ganeshrn The file has been reverted.

@ansibot ansibot added small_patch and removed merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Feb 27, 2019
Copy link
Member

@ganeshrn ganeshrn left a comment

Choose a reason for hiding this comment

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

@chrisvanheuveln Thank you!

@ganeshrn ganeshrn merged commit d69239c into ansible:devel Feb 28, 2019
@chrisvanheuveln chrisvanheuveln deleted the devel-src_invalid branch March 8, 2019 16:28
trishnaguha pushed a commit to trishnaguha/ansible that referenced this pull request Apr 1, 2019
…es (ansible#52745)

* network.py:ActionModule:run: does not honor _handle_src_option failures

PR ansible#50301 moved template error handling out of run() and into its
own method in `_handle_src_option`; however, after the change run()
ignores the return value so any errors are ignored.

Reproduceable with `nxos_config/tests/common/src_invalid.yaml`

Verified fix with `nxos_config/tests/common/src_*` tests.

Ref:
ansible@71113ee#diff-7477bf046013758366cc85b06f90709aR43

* nxos_config/tests/common/src_basic: Updated to test with src

This test was not actually testing with `src:` as it should have.

* Revert 412d7e change to plugins/action/network.py

PR ansible#52912 fixed this already.

* nxos_config: fix src_invalid test

(cherry picked from commit d69239c)
abadger pushed a commit that referenced this pull request Apr 4, 2019
…es (#52745)

* network.py:ActionModule:run: does not honor _handle_src_option failures

PR #50301 moved template error handling out of run() and into its
own method in `_handle_src_option`; however, after the change run()
ignores the return value so any errors are ignored.

Reproduceable with `nxos_config/tests/common/src_invalid.yaml`

Verified fix with `nxos_config/tests/common/src_*` tests.

Ref:
71113ee#diff-7477bf046013758366cc85b06f90709aR43

* nxos_config/tests/common/src_basic: Updated to test with src

This test was not actually testing with `src:` as it should have.

* Revert 412d7e change to plugins/action/network.py

PR #52912 fixed this already.

* nxos_config: fix src_invalid test

(cherry picked from commit d69239c)
@ansible ansible locked and limited conversation to collaborators Jul 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. cisco Cisco technologies needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. networking Network category nxos Cisco NXOS community small_patch support:network This issue/PR relates to code supported by the Ansible Network Team. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants