Skip to content

Commit f6bd01b

Browse files
mks-mDavidS
authored andcommitted
Ignore :undefined_variable "reason" in getvar
`catch` returns value of second argument to `throw`, which until 860a2761f334c964068038b3ef6853f08beb1df5 was `nil`, but now is non-falsey reason for error. short-circuit using return and eval to nil if `throw` was caught.
1 parent 527a4f1 commit f6bd01b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/puppet/parser/functions/getvar.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ module Puppet::Parser::Functions
2121

2222
begin
2323
catch(:undefined_variable) do
24-
self.lookupvar("#{args[0]}")
24+
return self.lookupvar("#{args[0]}")
2525
end
26+
27+
nil # throw was caught
2628
rescue Puppet::ParseError # Eat the exception if strict_variables = true is set
2729
end
2830

0 commit comments

Comments
 (0)