This only works with facter 1.7.0-rc1 and up because os_key isn't
properly defined in facter 1.6.18 on Archlinux (it's set to Linux).
when :IPv4
["/bin/sh", "-c", "/sbin/iptables-save > /etc/iptables/rules"]
end
+ when :Archlinux
+ case proto.to_sym
+ when :IPv4
+ ["/bin/sh", "-c", "/usr/sbin/iptables-save > /etc/iptables/iptables.rules"]
+ when :IPv6
+ ["/bin/sh", "-c", "/usr/sbin/ip6tables-save > /etc/iptables/ip6tables.rules"]
+ end
end
# Catch unsupported OSs from the case statement above.
subject.persist_iptables(proto)
end
+ it 'should exec for Archlinux identified from osfamily' do
+ Facter.fact(:osfamily).stubs(:value).returns('Archlinux')
+ subject.expects(:execute).with(['/bin/sh', '-c', '/usr/sbin/iptables-save > /etc/iptables/iptables.rules'])
+ subject.persist_iptables(proto)
+ end
+
it 'should raise a warning when exec fails' do
Facter.fact(:osfamily).stubs(:value).returns('RedHat')
subject.expects(:execute).with(%w{/sbin/service iptables save}).