From 7f8bc6f99d1e15c1e415b4f443576e0631c3ad7c Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Wed, 11 Mar 2026 22:15:52 +0100 Subject: [PATCH] [PR #11541/4cd91ba4 backport][stable-12] Fix templating bug in iptables_state tests (#11572) Fix templating bug in iptables_state tests (#11541) * Fix templating bug in iptables_state tests. * Try to install older packages on RHEL. (cherry picked from commit 4cd91ba4d41fe25466230e7a1787a393c608adcb) Co-authored-by: Felix Fontein --- .../integration/targets/iptables_state/tasks/main.yml | 11 ++++++++++- .../targets/iptables_state/tasks/tests/01-tables.yml | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/integration/targets/iptables_state/tasks/main.yml b/tests/integration/targets/iptables_state/tasks/main.yml index d550070677..5f72dc9faa 100644 --- a/tests/integration/targets/iptables_state/tasks/main.yml +++ b/tests/integration/targets/iptables_state/tasks/main.yml @@ -8,12 +8,21 @@ # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) # SPDX-License-Identifier: GPL-3.0-or-later -- name: ensure iptables package is installed +- name: ensure iptables package is installed (non-RHEL) package: name: - iptables become: true + when: not (ansible_facts.distribution == 'RedHat' and ansible_facts.distribution_major_version|int >= 10) +- name: ensure iptables package is installed (RHEL 10+) + package: + name: + - "kernel-modules-extra-matched-{{ ansible_facts.kernel }}" + - "iptables-nft" + - "kernel-modules-extra-{{ ansible_facts.kernel }}" + become: true + when: ansible_facts.distribution == 'RedHat' and ansible_facts.distribution_major_version|int >= 10 - name: include tasks vars: diff --git a/tests/integration/targets/iptables_state/tasks/tests/01-tables.yml b/tests/integration/targets/iptables_state/tasks/tests/01-tables.yml index d4c3a550e8..26b529fac0 100644 --- a/tests/integration/targets/iptables_state/tasks/tests/01-tables.yml +++ b/tests/integration/targets/iptables_state/tasks/tests/01-tables.yml @@ -272,7 +272,7 @@ assert: that: - iptables_state is failed - - "iptables_state.msg == 'Table mangle to restore not defined in {{ iptables_tests }}'" + - "iptables_state.msg == ('Table mangle to restore not defined in ' ~ iptables_tests)" success_msg: >- The previous error has been triggered by trying to restore a table that is missing in the file provided to iptables-restore.