network.py:ActionModule:run: does not honor _handle_src_option failures (#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:
71113ee291 (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
This commit is contained in:
Chris Van Heuveln 2019-02-28 00:37:03 -05:00 committed by Ganesh Nalawade
parent e4d0be39c3
commit d69239c440
2 changed files with 4 additions and 15 deletions

View file

@ -1,8 +1,7 @@
--- ---
- debug: msg="START common/src_basic.yaml on connection={{ ansible_connection }}" - debug: msg="START common/src_basic.yaml on connection={{ ansible_connection }}"
# Select interface for test - set_fact: intname="loopback1"
- set_fact: intname="{{ nxos_int1 }}"
- name: setup - name: setup
nxos_config: nxos_config:
@ -16,13 +15,9 @@
- name: configure device with config - name: configure device with config
nxos_config: nxos_config:
commands: src: basic/config.j2
- description this is a test
- shutdown
parents:
- "interface {{ intname }}"
defaults: yes
provider: "{{ connection }}" provider: "{{ connection }}"
defaults: yes
register: result register: result
- assert: - assert:
@ -33,12 +28,7 @@
- name: check device with config - name: check device with config
nxos_config: nxos_config:
commands: src: basic/config.j2
- description this is a test
- shutdown
parents:
- "interface {{ intname }}"
defaults: yes
provider: "{{ connection }}" provider: "{{ connection }}"
register: result register: result

View file

@ -12,7 +12,6 @@
- assert: - assert:
that: that:
- "result.changed == false"
- "result.failed == true" - "result.failed == true"
- "result.msg == 'path specified in src not found'" - "result.msg == 'path specified in src not found'"