Skip to content

Commit

Permalink
Merge pull request puppetlabs#674 from DavidS/modules-3969-fix-getvar…
Browse files Browse the repository at this point in the history
…-for-187

(MODULES-3969) Update getvar to work on ruby 1.8.7
  • Loading branch information
bmjen authored Oct 12, 2016
2 parents d990021 + 1d75813 commit f2492ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ This bugfix release addresses the `undefined method 'optional_repeated_param'` e

It also improves the user experience around function deprecations by emitting one warning per function(-name) instead of only one deprecation overall. This allows users to identify all deprecated functions used in one agent run, with less back-and-forth.

Finally, this release adds additional Puppet 4 overrides for the `is_` counterparts of the deprecated functions to emit the deprecations warnings in all cases.
#### Bugfixes

* Emit deprecations warnings for each function, instead of once per process. (MODULES-3961)
* Use a universally available API for the v4 deprecation stubs of `is_*` and `validate_*`. (MODULES-3962)
* Make `getvar()` compatible to ruby 1.8.7. (MODULES-3969)
* Add v4 deprecation stubs for the `is_` counterparts of the deprecated functions to emit the deprecations warnings in all cases.


## Supported Release 4.13.0
### Summary
Expand Down
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 f2492ee

Please sign in to comment.