From: Dan Carley Date: Sat, 23 Feb 2013 14:10:39 +0000 (+0000) Subject: Fix tests for Ruby 1.9.3 from 3e13bf3 X-Git-Tag: 0.1.0~7^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=5dff0757ce4453893fe00ddbe3a358483d1cb74f;p=puppet-modules%2Fpuppetlabs-firewall.git Fix tests for Ruby 1.9.3 from 3e13bf3 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. --- diff --git a/lib/puppet/provider/firewall/iptables.rb b/lib/puppet/provider/firewall/iptables.rb index 512c8f1..b34e736 100644 --- a/lib/puppet/provider/firewall/iptables.rb +++ b/lib/puppet/provider/firewall/iptables.rb @@ -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.