]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
small refactor of value munging of existing rules
authorJonathan Boyett <jonathan@failingservers.com>
Mon, 15 Aug 2011 18:18:14 +0000 (11:18 -0700)
committerJonathan Boyett <jonathan@failingservers.com>
Mon, 15 Aug 2011 18:18:14 +0000 (11:18 -0700)
lib/puppet/provider/firewall/iptables.rb

index ebcee19d71873b63e14755c57305ef4d0b648159..8318ac92bb33ed68fa75ecc67df90ec7ecc85ee8 100644 (file)
@@ -116,13 +116,11 @@ Puppet::Type.type(:firewall).provide :iptables, :parent => Puppet::Provider::Fir
     keys << :chain
 
     keys.zip(values.scan(/"[^"]*"|\S+/).reverse) { |f, v| hash[f] = v.gsub(/"/, '') }
-    [:dport, :sport, :destination, :source, :state].each do |prop|
-      if hash[prop] =~ /,/
-        hash[prop] = hash[prop].split(',')
-      else
-        hash[prop] = [hash[prop]]
-      end
+    
+    [:dport, :sport, :state].each do |prop|
+      hash[prop] = hash[prop].split(',') if ! hash[prop].nil?
     end
+    
     hash[:provider] = self.name.to_s
     hash[:table] = table
     hash[:ensure] = :present