Skip to content
Browse files

(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.
  • Loading branch information...
1 parent 6ae5794 commit f6bc77e73e137ca1ebb70e8d62461f9105487864 @dcarley dcarley committed Mar 3, 2013
Showing with 7 additions and 5 deletions.
  1. +7 −5 lib/puppet/type/firewall.rb
View
12 lib/puppet/type/firewall.rb
@@ -559,18 +559,20 @@ def should_to_s(value)
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

0 comments on commit f6bc77e

Please sign in to comment.
Something went wrong with that request. Please try again.