]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Fixed dumb logic error
authorJoe Julian <me@joejulian.name>
Fri, 31 May 2013 01:59:23 +0000 (18:59 -0700)
committerJoe Julian <me@joejulian.name>
Fri, 31 May 2013 01:59:23 +0000 (18:59 -0700)
lib/puppet/provider/firewall/iptables.rb

index 4f033712ef1e2d615cfc6845f75552d1b68f21f9..a9855e0d0d0dc1c07aff4158bccac036ea85b714 100644 (file)
@@ -233,13 +233,12 @@ Puppet::Type.type(:firewall).provide :iptables, :parent => Puppet::Provider::Fir
     # Puppet-firewall requires that all rules have comments (resource names) and match this 
     # regex and will fail if a rule in iptables does not have a comment. We get around this 
     # by appending a high level
-    if not /^\d+[[:alpha:][:digit:][:punct:][:space:]]+$/ =~ hash[:name]
-      num = 9000 + counter
-      hash[:name] = "#{num} #{/([[:alpha:][:digit:][:punct:][:space:]]+)/.match(hash[:name])[1]}"
-    end
     if ! hash[:name]
       num = 9000 + counter
       hash[:name] = "#{num} #{Digest::MD5.hexdigest(line)}"
+    elsif not /^\d+[[:alpha:][:digit:][:punct:][:space:]]+$/ =~ hash[:name]
+      num = 9000 + counter
+      hash[:name] = "#{num} #{/([[:alpha:][:digit:][:punct:][:space:]]+)/.match(hash[:name])[1]}"
     end
 
     # Iptables defaults to log_level '4', so it is omitted from the output of iptables-save.