Skip to content

Commit

Permalink
Ignore :undefined_variable "reason" in getvar
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
mks-m authored and DavidS committed Oct 8, 2016
1 parent 527a4f1 commit f6bd01b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/puppet/parser/functions/getvar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ module Puppet::Parser::Functions

begin
catch(:undefined_variable) do
self.lookupvar("#{args[0]}")
return self.lookupvar("#{args[0]}")
end

nil # throw was caught
rescue Puppet::ParseError # Eat the exception if strict_variables = true is set
end

Expand Down

0 comments on commit f6bd01b

Please sign in to comment.