Skip to content

Commit ba75def

Browse files
committed
Configures iptables alternatives on specific OS versions
Ensures consistent iptables behavior across CentOS/AlmaLinux/Rocky 8 by switching to the legacy iptables implementation. These OS versions use nftables by default, which has a different syntax. This change provides a consistent testing environment.
1 parent 3b97d1b commit ba75def

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

spec/spec_helper_acceptance_local.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,11 @@ def fetch_os_name
114114
# this so that policycoreutils is installed on platform where the os.family fact
115115
# is set to 'redhat'
116116
LitmusHelper.instance.run_shell('yum install policycoreutils -y') if ['almalinux-8', 'rocky-8'].include?("#{fetch_os_name}-#{os[:release].to_i}")
117+
118+
# On CentOS/AlmaLinux/Rocky 8 iptables is just a frontend to nftables
119+
# and the syntax is different. Switch to legacy iptables to have a
120+
# consistent experience across OS versions.
121+
LitmusHelper.instance.run_shell('sudo update-alternatives --set iptables /usr/sbin/iptables-legacy') if ['almalinux-8', 'centos-8', 'rocky-8'].include?("#{fetch_os_name}-#{os[:release].to_i}")
122+
LitmusHelper.instance.run_shell('sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy') if ['almalinux-8', 'centos-8', 'rocky-8'].include?("#{fetch_os_name}-#{os[:release].to_i}")
117123
end
118124
end

0 commit comments

Comments
 (0)