summaryrefslogtreecommitdiff
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/parser/functions/getvar.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/puppet/parser/functions/getvar.rb b/lib/puppet/parser/functions/getvar.rb
index aa6edbb..3af8d48 100644
--- a/lib/puppet/parser/functions/getvar.rb
+++ b/lib/puppet/parser/functions/getvar.rb
@@ -20,11 +20,13 @@ module Puppet::Parser::Functions
end
begin
+ result = nil
catch(:undefined_variable) do
- return self.lookupvar("#{args[0]}")
+ result = self.lookupvar("#{args[0]}")
end
-
- nil # throw was caught
+
+ # 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