diff options
author | GomathiselviS <gomathiselvi@gmail.com> | 2020-07-21 17:32:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-21 21:32:18 +0000 |
commit | d313ae144ff794d84f738b6fc2792834bfc6370b (patch) | |
tree | 06aefb097b920d42477932ff18915d71d12e91d6 | |
parent | 29dcf4c64967ed65f216b166de1e4ffcb085075c (diff) | |
download | vyos-ansible-old-d313ae144ff794d84f738b6fc2792834bfc6370b.tar.gz vyos-ansible-old-d313ae144ff794d84f738b6fc2792834bfc6370b.zip |
Avoid set_fact dynamically assigning value to a variable (#70)
Avoid set_fact dynamically assigning value to a variable
Reviewed-by: https://github.com/apps/ansible-zuul
-rw-r--r-- | changelogs/fragments/70-workaround-set_fact.yaml | 3 | ||||
-rw-r--r-- | tests/integration/targets/vyos_interface/tests/cli/intent.yaml | 28 |
2 files changed, 18 insertions, 13 deletions
diff --git a/changelogs/fragments/70-workaround-set_fact.yaml b/changelogs/fragments/70-workaround-set_fact.yaml new file mode 100644 index 0000000..2fac51a --- /dev/null +++ b/changelogs/fragments/70-workaround-set_fact.yaml @@ -0,0 +1,3 @@ +--- +bug_fix: + - Added workaround to avoid set_fact dynamically assigning value. This behavior seems to have been broken after ansible2.9. diff --git a/tests/integration/targets/vyos_interface/tests/cli/intent.yaml b/tests/integration/targets/vyos_interface/tests/cli/intent.yaml index 69ab779..e3245d3 100644 --- a/tests/integration/targets/vyos_interface/tests/cli/intent.yaml +++ b/tests/integration/targets/vyos_interface/tests/cli/intent.yaml @@ -7,17 +7,19 @@ commands: - show lldp neighbors detail -- name: Should we run lldp tests? - set_fact: - run_lldp_tests: "'PortDescr: eth0' in neighbors_out.stdout[0]" + +# setting a variable dynamically using set_fact isn't working in devel. +# - name: Should we run lldp tests? +# set_fact: +# run_lldp_tests: "'PortDescr: eth0' in neighbors_out.stdout[0]" - name: Enable LLDP service - when: run_lldp_tests + when: "'PortDescr: eth0' in neighbors_out.stdout[0]" vyos.vyos.vyos_lldp: state: present - name: Create LLDP configuration - when: run_lldp_tests + when: "'PortDescr: eth0' in neighbors_out.stdout[0]" vyos.vyos.vyos_lldp_interface: name: eth1 state: present @@ -40,7 +42,7 @@ - result.failed == false - name: Check lldp neighbors intent arguments - when: run_lldp_tests + when: "'PortDescr: eth0' in neighbors_out.stdout[0]" register: result vyos.vyos.vyos_interface: name: eth0 @@ -51,7 +53,7 @@ - assert: that: - result.failed == false - when: run_lldp_tests + when: "'PortDescr: eth0' in neighbors_out.stdout[0]" - name: Check intent arguments (failed condition) ignore_errors: true @@ -67,7 +69,7 @@ - name: Check lldp neighbors intent arguments (failed) ignore_errors: true - when: run_lldp_tests + when: "'PortDescr: eth0' in neighbors_out.stdout[0]" register: result vyos.vyos.vyos_interface: name: eth0 @@ -81,7 +83,7 @@ - result.failed == true - "'host dummy_host' in result.failed_conditions" - "'port dummy_port' in result.failed_conditions" - when: run_lldp_tests + when: "'PortDescr: eth0' in neighbors_out.stdout[0]" - name: Config + intent register: result @@ -122,7 +124,7 @@ - result.failed == false - name: Check lldp neighbors intent aggregate arguments - when: run_lldp_tests + when: "'PortDescr: eth0' in neighbors_out.stdout[0]" register: result vyos.vyos.vyos_interface: aggregate: @@ -135,11 +137,11 @@ - assert: that: - result.failed == false - when: run_lldp_tests + when: "'PortDescr: eth0' in neighbors_out.stdout[0]" - name: Check lldp neighbors intent aggregate arguments (failed) ignore_errors: true - when: run_lldp_tests + when: "'PortDescr: eth0' in neighbors_out.stdout[0]" register: result vyos.vyos.vyos_interface: aggregate: @@ -157,4 +159,4 @@ - result.failed == true - "'host dummy_host' in result.failed_conditions" - "'port dummy_port' in result.failed_conditions" - when: run_lldp_tests + when: "'PortDescr: eth0' in neighbors_out.stdout[0]" |