Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(MODULES-3969) Update getvar to work on ruby 1.8.7 #674

Merged
merged 2 commits into from
Oct 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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