From 8eed9ae4a969a9ae94e07603207d877a47c8a1c5 Mon Sep 17 00:00:00 2001 From: Wen Liang Date: Tue, 14 Mar 2023 19:33:39 -0400 Subject: [PATCH] ansible-lint: Fix ignore-errors failures In some test playbooks, the `ignore_errors: true` can not be replaced by `changed_when: false`, because `changed_when` is not a valid attribute for a IncludeRole. Signed-off-by: Wen Liang --- tests/get_coverage.yml | 2 +- tests/playbooks/manual_test_ethtool_coalesce.yml | 2 +- tests/playbooks/tests_802_1x.yml | 2 +- tests/playbooks/tests_bond.yml | 4 ++-- tests/playbooks/tests_bond_cloned_mac.yml | 4 ++-- tests/playbooks/tests_bond_deprecated.yml | 4 ++-- tests/playbooks/tests_bond_options.yml | 4 ++-- tests/playbooks/tests_bond_removal.yml | 4 ++-- tests/playbooks/tests_checkpoint_cleanup.yml | 2 +- tests/playbooks/tests_eth_pci_address_match.yml | 2 +- tests/playbooks/tests_ethtool_coalesce.yml | 2 +- tests/playbooks/tests_ethtool_features.yml | 2 +- tests/playbooks/tests_ethtool_ring.yml | 2 +- tests/playbooks/tests_infiniband.yml | 4 ++-- tests/playbooks/tests_ipv6_dns_search.yml | 2 +- tests/playbooks/tests_reapply.yml | 2 +- tests/playbooks/tests_wireless.yml | 2 +- tests/tests_change_indication_on_repeat_run.yml | 2 +- tests/tests_unit.yml | 2 +- 19 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tests/get_coverage.yml b/tests/get_coverage.yml index 8a90cee..7411958 100644 --- a/tests/get_coverage.yml +++ b/tests/get_coverage.yml @@ -30,7 +30,7 @@ command: "{{ coverage }} combine" environment: COVERAGE_FILE: "{{ coverage_file }}" - ignore_errors: true + failed_when: false changed_when: false - name: remove old data diff --git a/tests/playbooks/manual_test_ethtool_coalesce.yml b/tests/playbooks/manual_test_ethtool_coalesce.yml index e4c26d0..2cbfb29 100644 --- a/tests/playbooks/manual_test_ethtool_coalesce.yml +++ b/tests/playbooks/manual_test_ethtool_coalesce.yml @@ -112,7 +112,7 @@ - name: "{{ interface }}" persistent_state: absent state: down - ignore_errors: true + failed_when: false - include_tasks: tasks/manage_test_interface.yml vars: state: absent diff --git a/tests/playbooks/tests_802_1x.yml b/tests/playbooks/tests_802_1x.yml index 5565e5b..72e2517 100644 --- a/tests/playbooks/tests_802_1x.yml +++ b/tests/playbooks/tests_802_1x.yml @@ -106,7 +106,7 @@ - name: br1 persistent_state: absent state: down - ignore_errors: true + failed_when: false - include_tasks: tasks/cleanup_802_1x_server.yml - name: Remove test certificates file: diff --git a/tests/playbooks/tests_bond.yml b/tests/playbooks/tests_bond.yml index fd3af90..eebecb0 100644 --- a/tests/playbooks/tests_bond.yml +++ b/tests/playbooks/tests_bond.yml @@ -101,9 +101,9 @@ - name: "{{ controller_profile }}" persistent_state: absent state: down - ignore_errors: true + failed_when: false - command: ip link del {{ controller_device }} - ignore_errors: true + failed_when: false - import_tasks: tasks/remove_test_interfaces_with_dhcp.yml - name: "Restore the /etc/resolv.conf for initscript" command: mv -vf /etc/resolv.conf.bak /etc/resolv.conf diff --git a/tests/playbooks/tests_bond_cloned_mac.yml b/tests/playbooks/tests_bond_cloned_mac.yml index 4d7f0dd..5503c84 100644 --- a/tests/playbooks/tests_bond_cloned_mac.yml +++ b/tests/playbooks/tests_bond_cloned_mac.yml @@ -120,9 +120,9 @@ - name: "{{ controller_profile }}" persistent_state: absent state: down - ignore_errors: true + failed_when: false - command: ip link del {{ controller_device }} - ignore_errors: true + failed_when: false - import_tasks: tasks/remove_test_interfaces_with_dhcp.yml - name: Restore the /etc/resolv.conf for initscript command: mv -vf /etc/resolv.conf.bak /etc/resolv.conf diff --git a/tests/playbooks/tests_bond_deprecated.yml b/tests/playbooks/tests_bond_deprecated.yml index a3006ef..e92e3ed 100644 --- a/tests/playbooks/tests_bond_deprecated.yml +++ b/tests/playbooks/tests_bond_deprecated.yml @@ -97,7 +97,7 @@ - name: "{{ controller_profile }}" persistent_state: absent state: down - ignore_errors: true + failed_when: false - command: ip link del {{ controller_device }} - ignore_errors: true + failed_when: false - import_tasks: tasks/remove_test_interfaces_with_dhcp.yml diff --git a/tests/playbooks/tests_bond_options.yml b/tests/playbooks/tests_bond_options.yml index decfbbc..fb19f01 100644 --- a/tests/playbooks/tests_bond_options.yml +++ b/tests/playbooks/tests_bond_options.yml @@ -188,7 +188,7 @@ - name: "{{ controller_profile }}" persistent_state: absent state: down - ignore_errors: true + failed_when: false - command: ip link del {{ controller_device }} - ignore_errors: true + failed_when: false - import_tasks: tasks/remove_test_interfaces_with_dhcp.yml diff --git a/tests/playbooks/tests_bond_removal.yml b/tests/playbooks/tests_bond_removal.yml index 45114bf..6721b4f 100644 --- a/tests/playbooks/tests_bond_removal.yml +++ b/tests/playbooks/tests_bond_removal.yml @@ -235,9 +235,9 @@ - name: "{{ controller_profile }}" state: down persistent_state: absent - ignore_errors: true + failed_when: false - command: ip link del {{ controller_device }} - ignore_errors: true + failed_when: false - import_tasks: tasks/remove_test_interfaces_with_dhcp.yml - name: "Restore the /etc/resolv.conf for initscript" command: mv -vf /etc/resolv.conf.bak /etc/resolv.conf diff --git a/tests/playbooks/tests_checkpoint_cleanup.yml b/tests/playbooks/tests_checkpoint_cleanup.yml index 8eafc8d..e47f729 100644 --- a/tests/playbooks/tests_checkpoint_cleanup.yml +++ b/tests/playbooks/tests_checkpoint_cleanup.yml @@ -74,7 +74,7 @@ always: - tags: - "tests::cleanup" - ignore_errors: true + ignore_errors: true # noqa ignore-errors block: # Use internal module directly for speedup - network_connections: diff --git a/tests/playbooks/tests_eth_pci_address_match.yml b/tests/playbooks/tests_eth_pci_address_match.yml index afa749f..eed7736 100644 --- a/tests/playbooks/tests_eth_pci_address_match.yml +++ b/tests/playbooks/tests_eth_pci_address_match.yml @@ -75,4 +75,4 @@ - name: pseudo-pci-test-only persistent_state: absent state: down - ignore_errors: true + failed_when: false diff --git a/tests/playbooks/tests_ethtool_coalesce.yml b/tests/playbooks/tests_ethtool_coalesce.yml index eb49236..9b8915b 100644 --- a/tests/playbooks/tests_ethtool_coalesce.yml +++ b/tests/playbooks/tests_ethtool_coalesce.yml @@ -155,7 +155,7 @@ network_connections: - name: "{{ interface }}" persistent_state: absent - ignore_errors: true + failed_when: false - include_tasks: tasks/manage_test_interface.yml vars: state: absent diff --git a/tests/playbooks/tests_ethtool_features.yml b/tests/playbooks/tests_ethtool_features.yml index ee67ca3..67f7c42 100644 --- a/tests/playbooks/tests_ethtool_features.yml +++ b/tests/playbooks/tests_ethtool_features.yml @@ -202,7 +202,7 @@ - name: "{{ interface }}" persistent_state: absent state: down - ignore_errors: true + failed_when: false - include_tasks: tasks/manage_test_interface.yml vars: state: absent diff --git a/tests/playbooks/tests_ethtool_ring.yml b/tests/playbooks/tests_ethtool_ring.yml index 8eaf933..0a5d24c 100644 --- a/tests/playbooks/tests_ethtool_ring.yml +++ b/tests/playbooks/tests_ethtool_ring.yml @@ -193,7 +193,7 @@ network_connections: - name: "{{ interface }}" persistent_state: absent - ignore_errors: true + failed_when: false - include_tasks: tasks/manage_test_interface.yml vars: state: absent diff --git a/tests/playbooks/tests_infiniband.yml b/tests/playbooks/tests_infiniband.yml index f5fa064..9b4884a 100644 --- a/tests/playbooks/tests_infiniband.yml +++ b/tests/playbooks/tests_infiniband.yml @@ -76,6 +76,6 @@ - name: ib0-10 persistent_state: absent state: down - ignore_errors: true + failed_when: false - command: ip link del ib0.000a - ignore_errors: true + failed_when: false diff --git a/tests/playbooks/tests_ipv6_dns_search.yml b/tests/playbooks/tests_ipv6_dns_search.yml index c94396a..a562449 100644 --- a/tests/playbooks/tests_ipv6_dns_search.yml +++ b/tests/playbooks/tests_ipv6_dns_search.yml @@ -156,4 +156,4 @@ - name: br-example persistent_state: absent state: down - ignore_errors: true + failed_when: false diff --git a/tests/playbooks/tests_reapply.yml b/tests/playbooks/tests_reapply.yml index 964a388..0b13b96 100644 --- a/tests/playbooks/tests_reapply.yml +++ b/tests/playbooks/tests_reapply.yml @@ -59,7 +59,7 @@ always: - tags: - "tests::cleanup" - ignore_errors: true + ignore_errors: true # noqa ignore-errors block: # Use internal module directly for speedup - network_connections: diff --git a/tests/playbooks/tests_wireless.yml b/tests/playbooks/tests_wireless.yml index e33523d..b3f27f9 100644 --- a/tests/playbooks/tests_wireless.yml +++ b/tests/playbooks/tests_wireless.yml @@ -88,5 +88,5 @@ - name: "{{ interface }}" persistent_state: absent state: down - ignore_errors: true + failed_when: false - include_tasks: tasks/cleanup_mock_wifi.yml diff --git a/tests/tests_change_indication_on_repeat_run.yml b/tests/tests_change_indication_on_repeat_run.yml index 5b58af5..9660600 100644 --- a/tests/tests_change_indication_on_repeat_run.yml +++ b/tests/tests_change_indication_on_repeat_run.yml @@ -65,7 +65,7 @@ - name: "{{ interface }}" persistent_state: absent state: down - ignore_errors: true + ignore_errors: true # noqa ignore-errors - include_tasks: tasks/manage_test_interface.yml vars: state: absent diff --git a/tests/tests_unit.yml b/tests/tests_unit.yml index d8ba235..1b5a409 100644 --- a/tests/tests_unit.yml +++ b/tests/tests_unit.yml @@ -10,7 +10,7 @@ name: "{{ item }}" state: present # Ignore error because some package names might not be available - ignore_errors: true + ignore_errors: true # noqa ignore-errors loop: - NetworkManager-libnm - python2-gobject-base