summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Schmitt <david.schmitt@puppet.com>2016-10-12 16:11:02 +0100
committerDavid Schmitt <david.schmitt@puppet.com>2016-10-12 16:11:24 +0100
commita0f86644cd254697b4c875a7a8e34fbb1010cf3a (patch)
tree54f0df5c601bc55d8ddfd5418cd0410366107c64 /lib
parentd9900211cc5a4efe18452e9908e50e08ea27436c (diff)
(MODULES-3969) Update getvar to work on ruby 1.8.7
Diffstat (limited to 'lib')
-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