Skip to content

Commit c12fc3a

Browse files
authored
Merge pull request #1272 from puppetlabs/MODULES-11593-lack-of-i-pv-6-rule-saving-command-for-suse-case-01422802
MODULES-11593: Add IPv6 rule saving command for Suse in utility and update specs
2 parents 0c2881b + e2d9586 commit c12fc3a

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

lib/puppet_x/puppetlabs/firewall/utility.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def self.persist_iptables(context, name, protocol)
4343
case protocol
4444
when 'IPv4', 'iptables'
4545
['/bin/sh', '-c', '/usr/sbin/iptables-save > /etc/sysconfig/iptables']
46+
when 'IPv6', 'ip6tables'
47+
['/bin/sh', '-c', '/usr/sbin/ip6tables-save > /etc/sysconfig/ip6tables']
4648
end
4749
else
4850
# Catch unsupported OSs

spec/acceptance/firewall_attributes_ipv6_exceptions_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
end
1313
end
1414

15-
describe 'standard attributes', unless: os[:family] == 'sles' do
15+
describe 'standard attributes' do
1616
describe 'dst_range' do
1717
context 'when 2001::db8::1-2001:db8::ff' do
1818
pp = <<-PUPPETCODE
@@ -381,7 +381,7 @@ class { '::firewall': }
381381
end
382382
end
383383

384-
describe 'ishasmorefrags/islastfrag/isfirstfrag', unless: os[:family] == 'sles' do
384+
describe 'ishasmorefrags/islastfrag/isfirstfrag' do
385385
shared_examples 'is idempotent' do |values, line_match|
386386
pp2 = <<-PUPPETCODE
387387
class { '::firewall': }

spec/acceptance/firewall_attributes_ipv6_happy_path_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require 'spec_helper_acceptance'
44

5-
describe 'firewall attribute testing, happy path', unless: (os[:family] == 'sles') do
5+
describe 'firewall attribute testing, happy path' do
66
before :all do
77
iptables_flush_all_tables
88
ip6tables_flush_all_tables

spec/unit/puppet_x/puppetlabs/firewall/utility_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@
7070

7171
utility.persist_iptables(context, 'test', proto)
7272
end
73+
74+
it 'and OS family is Suse' do
75+
allow(Facter.fact('os')).to receive(:value).and_return({ 'family' => 'Suse' })
76+
expect(Puppet::Provider).to receive(:execute).with(['/bin/sh', '-c', '/usr/sbin/ip6tables-save > /etc/sysconfig/ip6tables'])
77+
78+
utility.persist_iptables(context, 'test', proto)
79+
end
7380
end
7481
end
7582

0 commit comments

Comments
 (0)