]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
replace String#lines with a String#split to ensure compatibility with Ruby 1.8.5
authorJonathan Boyett <jonathan@failingservers.com>
Mon, 11 Jul 2011 17:19:07 +0000 (10:19 -0700)
committerJonathan Boyett <jonathan@failingservers.com>
Mon, 11 Jul 2011 17:19:07 +0000 (10:19 -0700)
lib/puppet/provider/firewall/iptables.rb

index 7e87e1484c34bd7c7dcf13f41d68ea036b184f61..84238a850a88689bbec757400bfa2ce5c214dba9 100644 (file)
@@ -72,10 +72,12 @@ Puppet::Type.type(:firewall).provide :iptables, :parent => Puppet::Provider::Fir
     table = nil
     rules = []
     counter = 1
-    iptables_save.lines do |line|
+
+    # String#lines would be nice, but we need to support Ruby 1.8.5
+    iptables_save.split("\n").each do |line|
       unless line =~ /^\#\s+|^\:\S+|^COMMIT/
         if line =~ /^\*/
-          table = line.sub(/\*/, "").chomp!
+          table = line.sub(/\*/, "")
         else
           if hash = rule_to_hash(line, table, counter)
             rules << new(hash)