]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
(#20125) Add persistence support for Archlinux platform
authorIngmar Steen <iksteen@gmail.com>
Mon, 8 Apr 2013 12:38:27 +0000 (14:38 +0200)
committerKen Barber <ken@bob.sh>
Fri, 12 Apr 2013 12:26:58 +0000 (13:26 +0100)
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).

lib/puppet/util/firewall.rb
spec/unit/puppet/util/firewall_spec.rb

index 47ef27ef3de57844d4f3f9570e8d06321c1da75a..5de08c374835a2104fcecb4d9ec2826d4a523366 100644 (file)
@@ -170,6 +170,13 @@ module Puppet::Util::Firewall
       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.
index 16ae82b6aca78a0b8408d481199faa8d0778c228..6345966308fd220ac1707c5da096d4452b1e07e0 100644 (file)
@@ -108,6 +108,12 @@ describe 'Puppet::Util::Firewall' do
         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}).