]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Use a more generic way for parsing negated options, not only for destination and...
authorJan Vansteenkiste <jan@vstone.eu>
Thu, 23 Aug 2012 07:13:26 +0000 (09:13 +0200)
committerPatrick Hemmer <patrick.hemmer@gmail.com>
Fri, 20 Dec 2013 20:11:29 +0000 (15:11 -0500)
lib/puppet/provider/firewall/iptables.rb

index 81f8b1931b87d84a3000af69ff31142659ca1f8d..90e7926efc4ece3a8037cde18ed16b6e4d214711 100644 (file)
@@ -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|