]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Add chain to keys list only if defined in the rule
authorAndjelko Horvat <andjelko.horvat.comel@gmail.com>
Thu, 8 Dec 2016 22:43:07 +0000 (23:43 +0100)
committerAndjelko Horvat <andjelko.horvat.comel@gmail.com>
Thu, 8 Dec 2016 22:43:07 +0000 (23:43 +0100)
lib/puppet/provider/firewall/iptables.rb

index cb1d1d3b136445b80a7614a812dbf23b81b7f607..b43a9058e735559f9e7eb2f0ba5d190ab8d70a60 100644 (file)
@@ -435,8 +435,10 @@ Puppet::Type.type(:firewall).provide :iptables, :parent => Puppet::Provider::Fir
     end
 
     # Manually remove chain
-    values.slice!('-A')
-    keys << :chain
+    if values =~ /(\s|^)-A\s/
+      values = values.sub(/(\s|^)-A\s/, '\1')
+      keys << :chain
+    end
 
     valrev = values.scan(/("([^"\\]|\\.)*"|\S+)/).transpose[0].reverse