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 @@ -1,160 +1,162 @@ --- - debug: msg="START cli/intent.yaml on connection={{ ansible_connection }}" - name: Detect if we have existing lldp neighbors configured register: neighbors_out vyos.vyos.vyos_command: 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 - name: Setup (interface is up) register: result vyos.vyos.vyos_interface: name: eth1 enabled: true state: present - name: Check intent arguments register: result vyos.vyos.vyos_interface: name: eth1 state: up - assert: that: - 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 neighbors: - port: eth0 - 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 register: result vyos.vyos.vyos_interface: name: eth1 state: down - assert: that: - result.failed == true - "'state eq(down)' in result.failed_conditions" - 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 neighbors: - port: dummy_port host: dummy_host - assert: that: - 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 vyos.vyos.vyos_interface: name: eth1 enabled: false state: down - assert: that: - result.failed == false - name: Config + intent (fail) ignore_errors: true register: result vyos.vyos.vyos_interface: name: eth1 enabled: false state: up - assert: that: - result.failed == true - "'state eq(up)' in result.failed_conditions" - name: Aggregate config + intent (pass) ignore_errors: true register: result vyos.vyos.vyos_interface: aggregate: - name: eth1 enabled: true state: up - assert: that: - 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: - name: eth0 neighbors: - port: eth0 - 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: - name: eth0 neighbors: - port: eth0 - port: dummy_port host: dummy_host - assert: that: - 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]"