Skip to content

Commit

Permalink
(MODULES-3969) Update getvar to work on ruby 1.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidS committed Oct 12, 2016
1 parent d990021 commit a0f8664
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/puppet/parser/functions/getvar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a0f8664

Please sign in to comment.