summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaksym Melnychok <keymone@gmail.com>2016-10-06 16:36:29 +0200
committerDavid Schmitt <david.schmitt@puppet.com>2016-10-08 16:14:19 +0100
commitf6bd01b784d279d477f327e5da76f3c27fcf4156 (patch)
tree7125521e55a5fe75c312c32a3fe6211b99436e44 /lib
parent527a4f1ebc21276458427fc5787a621fa8d5cb67 (diff)
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/parser/functions/getvar.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/puppet/parser/functions/getvar.rb b/lib/puppet/parser/functions/getvar.rb
index ae9c869..aa6edbb 100644
--- a/lib/puppet/parser/functions/getvar.rb
+++ b/lib/puppet/parser/functions/getvar.rb
@@ -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