Skip to content

Commit

Permalink
Fix breaking out of .each loop
Browse files Browse the repository at this point in the history
And some other small formatting fixes that don't belong in this patch.
  • Loading branch information
hunner committed Nov 11, 2014
1 parent 992ed8f commit 4949cfd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/puppet/parser/functions/has_interface_with.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ module Puppet::Parser::Functions
If no "kind" is given, then the presence of the interface is checked:
has_interface_with("lo") => true
EOS
EOS
) do |args|

raise(Puppet::ParseError, "has_interface_with(): Wrong number of arguments " +
"given (#{args.size} for 1 or 2)") if args.size < 1 or args.size > 2
"given (#{args.size} for 1 or 2)") if args.size < 1 or args.size > 2

interfaces = lookupvar('interfaces')

Expand Down Expand Up @@ -55,12 +55,14 @@ module Puppet::Parser::Functions
catch :undefined_variable do
factval = lookupvar("#{kind}_#{iface}")
end
if value == factval
result = true
end
rescue Puppet::ParseError # Eat the exception if strict_variables = true is set
end
if value == factval
result = true
break
end
end

result
end
end

0 comments on commit 4949cfd

Please sign in to comment.