Skip to content

Commit 4949cfd

Browse files
committed
Fix breaking out of .each loop
And some other small formatting fixes that don't belong in this patch.
1 parent 992ed8f commit 4949cfd

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

lib/puppet/parser/functions/has_interface_with.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ module Puppet::Parser::Functions
1616
1717
If no "kind" is given, then the presence of the interface is checked:
1818
has_interface_with("lo") => true
19-
EOS
19+
EOS
2020
) do |args|
2121

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

2525
interfaces = lookupvar('interfaces')
2626

@@ -55,12 +55,14 @@ module Puppet::Parser::Functions
5555
catch :undefined_variable do
5656
factval = lookupvar("#{kind}_#{iface}")
5757
end
58-
if value == factval
59-
result = true
60-
end
6158
rescue Puppet::ParseError # Eat the exception if strict_variables = true is set
6259
end
60+
if value == factval
61+
result = true
62+
break
63+
end
6364
end
65+
6466
result
6567
end
6668
end

0 commit comments

Comments
 (0)