]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Fix tests for Ruby 1.9.3 from 3e13bf3
authorDan Carley <dan.carley@gmail.com>
Sat, 23 Feb 2013 14:10:39 +0000 (14:10 +0000)
committerDan Carley <dan.carley@gmail.com>
Sat, 23 Feb 2013 14:10:39 +0000 (14:10 +0000)
Changes in 3e13bf3 broke tests for Ruby 1.9.3 which doesn't support
Enumerable on Strings. Workaround this by casting everything as an array and
flattening to prevent existing arrays from being encapsulated.

lib/puppet/provider/firewall/iptables.rb

index 512c8f1e36cd1258467d2a3cda610e0527638498..b34e73613279b88ab34cf5a141c7563508e2b5c3 100644 (file)
@@ -154,7 +154,7 @@ Puppet::Type.type(:firewall).provide :iptables, :parent => Puppet::Provider::Fir
     # Here we iterate across our values to generate an array of keys
     @resource_list.reverse.each do |k|
       resource_map_key = @resource_map[k]
-      resource_map_key.each do |opt|
+      [resource_map_key].flatten.each do |opt|
         if values.slice!(/\s#{opt}/)
           keys << k
           break
@@ -305,7 +305,7 @@ Puppet::Type.type(:firewall).provide :iptables, :parent => Puppet::Provider::Fir
         next
       end
 
-      args << resource_map[res].first.split(' ')
+      args << [resource_map[res]].flatten.first.split(' ')
 
       # For sport and dport, convert hyphens to colons since the type
       # expects hyphens for ranges of ports.