From 706f13b3835e9b4c749c88d60ea8f526e46baf80 Mon Sep 17 00:00:00 2001 From: Jan Vansteenkiste Date: Thu, 23 Aug 2012 09:13:26 +0200 Subject: [PATCH] Use a more generic way for parsing negated options, not only for destination and source --- lib/puppet/provider/firewall/iptables.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/puppet/provider/firewall/iptables.rb b/lib/puppet/provider/firewall/iptables.rb index 81f8b19..90e7926 100644 --- a/lib/puppet/provider/firewall/iptables.rb +++ b/lib/puppet/provider/firewall/iptables.rb @@ -168,11 +168,9 @@ Puppet::Type.type(:firewall).provide :iptables, :parent => Puppet::Provider::Fir # so it behaves like --comment values = values.sub(/--tcp-flags (\S*) (\S*)/, '--tcp-flags "\1 \2"') # we do a simular thing for negated address masks (source and destination). - values = values.sub(/-s (!)\s?(\S*)/, '-s "\1 \2"') - values = values.sub(/-d (!)\s?(\S*)/,'-d "\1 \2"') + values = values.sub(/(-\S+) (!)\s?(\S*)/,'\1 "\2 \3"') # the actual rule will have the ! mark before the option. - values = values.sub(/(!)\s*-s\s*(\S*)/, '-s "\1 \2"') - values = values.sub(/(!)\s*-d\s*(\S*)/, '-d "\1 \2"') + values = values.sub(/(!)\s*(-\S+)\s*(\S*)/, '\2 "\1 \3"') # Trick the system for booleans @known_booleans.each do |bool| -- 2.45.2