diff options
Diffstat (limited to 'lib/puppet/parser/functions/getvar.rb')
-rw-r--r-- | lib/puppet/parser/functions/getvar.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/puppet/parser/functions/getvar.rb b/lib/puppet/parser/functions/getvar.rb index fb336b6..3af8d48 100644 --- a/lib/puppet/parser/functions/getvar.rb +++ b/lib/puppet/parser/functions/getvar.rb @@ -20,7 +20,13 @@ module Puppet::Parser::Functions end begin - self.lookupvar("#{args[0]}") + result = nil + catch(:undefined_variable) do + result = self.lookupvar("#{args[0]}") + end + + # avoid relying on incosistent behaviour around ruby return values from catch + result rescue Puppet::ParseError # Eat the exception if strict_variables = true is set end |