From: Andjelko Horvat Date: Thu, 8 Dec 2016 22:43:07 +0000 (+0100) Subject: Add chain to keys list only if defined in the rule X-Git-Tag: 1.10.0~5^2~3 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=2a59271870f9bd67fda40c9fa3082421f9c5090e;p=puppet-modules%2Fpuppetlabs-firewall.git Add chain to keys list only if defined in the rule --- diff --git a/lib/puppet/provider/firewall/iptables.rb b/lib/puppet/provider/firewall/iptables.rb index cb1d1d3..b43a905 100644 --- a/lib/puppet/provider/firewall/iptables.rb +++ b/lib/puppet/provider/firewall/iptables.rb @@ -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