From d69239c440b54850b5a2477e2b1aeed4c8eea92f Mon Sep 17 00:00:00 2001 From: Chris Van Heuveln Date: Thu, 28 Feb 2019 00:37:03 -0500 Subject: [PATCH] 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: https://github.com/ansible/ansible/commit/71113ee291aa51f5363486537b3407204acb5a99#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 --- .../nxos_config/tests/common/src_basic.yaml | 18 ++++-------------- .../nxos_config/tests/common/src_invalid.yaml | 1 - 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/test/integration/targets/nxos_config/tests/common/src_basic.yaml b/test/integration/targets/nxos_config/tests/common/src_basic.yaml index 07d84b676f..f12dcb31c5 100644 --- a/test/integration/targets/nxos_config/tests/common/src_basic.yaml +++ b/test/integration/targets/nxos_config/tests/common/src_basic.yaml @@ -1,8 +1,7 @@ --- - debug: msg="START common/src_basic.yaml on connection={{ ansible_connection }}" -# Select interface for test -- set_fact: intname="{{ nxos_int1 }}" +- set_fact: intname="loopback1" - name: setup nxos_config: @@ -16,13 +15,9 @@ - name: configure device with config nxos_config: - commands: - - description this is a test - - shutdown - parents: - - "interface {{ intname }}" - defaults: yes + src: basic/config.j2 provider: "{{ connection }}" + defaults: yes register: result - assert: @@ -33,12 +28,7 @@ - name: check device with config nxos_config: - commands: - - description this is a test - - shutdown - parents: - - "interface {{ intname }}" - defaults: yes + src: basic/config.j2 provider: "{{ connection }}" register: result diff --git a/test/integration/targets/nxos_config/tests/common/src_invalid.yaml b/test/integration/targets/nxos_config/tests/common/src_invalid.yaml index ef2166a05f..f3405c3ebf 100644 --- a/test/integration/targets/nxos_config/tests/common/src_invalid.yaml +++ b/test/integration/targets/nxos_config/tests/common/src_invalid.yaml @@ -12,7 +12,6 @@ - assert: that: - - "result.changed == false" - "result.failed == true" - "result.msg == 'path specified in src not found'"