From f6bd01b784d279d477f327e5da76f3c27fcf4156 Mon Sep 17 00:00:00 2001 From: Maksym Melnychok Date: Thu, 6 Oct 2016 16:36:29 +0200 Subject: [PATCH] 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. --- lib/puppet/parser/functions/getvar.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/puppet/parser/functions/getvar.rb b/lib/puppet/parser/functions/getvar.rb index ae9c869d1..aa6edbb82 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