From: Dan Carley Date: Sun, 3 Mar 2013 14:32:38 +0000 (+0000) Subject: (GH-129) Replace errant return in autoreq block X-Git-Tag: 0.2.0~3^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f6bc77e73e137ca1ebb70e8d62461f9105487864;p=puppet-modules%2Fpuppetlabs-firewall.git (GH-129) Replace errant return in autoreq block It's not valid to use `return` within a block. We could use `next []`, however it's probably better form to just always return the array, whether it's populated or not. This will stop the error: err: Got an uncaught exception of type LocalJumpError: unexpected return When one of the listed providers isn't selected. Which is suitable, because this autorequire won't be suitable to any other future providers anyway. --- diff --git a/lib/puppet/type/firewall.rb b/lib/puppet/type/firewall.rb index 4f9ee4f..2fd0f00 100644 --- a/lib/puppet/type/firewall.rb +++ b/lib/puppet/type/firewall.rb @@ -559,18 +559,20 @@ Puppet::Type.newtype(:firewall) do end autorequire(:firewallchain) do + reqs = [] + protocol = nil + case value(:provider) when :iptables protocol = "IPv4" when :ip6tables protocol = "IPv6" - else - return end - reqs = [] - [value(:chain), value(:jump)].each do |chain| - reqs << "#{chain}:#{value(:table)}:#{protocol}" unless chain.nil? + unless protocol.nil? + [value(:chain), value(:jump)].each do |chain| + reqs << "#{chain}:#{value(:table)}:#{protocol}" unless chain.nil? + end end reqs