Skip to content

Commit f061452

Browse files
author
Morgan Haskel
committed
Merge pull request puppetlabs#405 from cdenneen/master
EL7 Fixes for CentOS
2 parents db96537 + fd5ab55 commit f061452

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lib/puppet/util/firewall.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def persist_iptables(proto)
169169
end
170170

171171
# RHEL 7 and newer also use systemd to persist iptable rules
172-
if os_key == 'RedHat' && Facter.value(:operatingsystem) == 'RedHat' && Facter.value(:operatingsystemrelease).to_i >= 7
172+
if os_key == 'RedHat' && ['RedHat','CentOS','Scientific','SL','SLC','Ascendos','CloudLinux','PSBM','OracleLinux','OVS','OEL','Amazon','XenServer'].include?(Facter.value(:operatingsystem)) && Facter.value(:operatingsystemrelease).to_i >= 7
173173
os_key = 'Fedora'
174174
end
175175

spec/unit/puppet/util/firewall_spec.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,22 @@
143143
subject.persist_iptables(proto)
144144
end
145145

146-
it 'should exec for CentOS identified from operatingsystem' do
146+
it 'should exec for CentOS 6 identified from operatingsystem and operatingsystemrelease' do
147147
allow(Facter.fact(:osfamily)).to receive(:value).and_return(nil)
148148
allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('CentOS')
149+
allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return('6.5')
149150
expect(subject).to receive(:execute).with(%w{/sbin/service iptables save})
150151
subject.persist_iptables(proto)
151152
end
152153

154+
it 'should exec for CentOS 7 identified from operatingsystem and operatingsystemrelease' do
155+
allow(Facter.fact(:osfamily)).to receive(:value).and_return(nil)
156+
allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('CentOS')
157+
allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return('7.0.1406')
158+
expect(subject).to receive(:execute).with(%w{/usr/libexec/iptables/iptables.init save})
159+
subject.persist_iptables(proto)
160+
end
161+
153162
it 'should exec for Archlinux identified from osfamily' do
154163
allow(Facter.fact(:osfamily)).to receive(:value).and_return('Archlinux')
155164
expect(subject).to receive(:execute).with(['/bin/sh', '-c', '/usr/sbin/iptables-save > /etc/iptables/iptables.rules'])

0 commit comments

Comments
 (0)