-
Notifications
You must be signed in to change notification settings - Fork 582
Pass calling scope to stdlib::ensure_packages
from shim
#1366
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
# THIS FILE WAS GENERATED BY `rake regenerate_unamespaced_shims` | ||
|
||
# @summary DEPRECATED. Use the namespaced function [`stdlib::ensure_packages`](#stdlibensure_packages) instead. | ||
Puppet::Functions.create_function(:ensure_packages) do | ||
Puppet::Functions.create_function(:ensure_packages, Puppet::Functions::InternalFunction) do | ||
dispatch :deprecation_gen do | ||
scope_param | ||
repeated_param 'Any', :args | ||
end | ||
def deprecation_gen(*args) | ||
def deprecation_gen(scope, *args) | ||
call_function('deprecation', 'ensure_packages', 'This function is deprecated, please use stdlib::ensure_packages instead.') | ||
call_function('stdlib::ensure_packages', *args) | ||
scope.call_function('stdlib::ensure_packages', args) | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum, maybe also change this line because it is what triggers the rake task that generated this code:
https://github.com/puppetlabs/puppetlabs-stdlib/blob/main/Rakefile#L95
Very hackish :-/
Otherwise we can search for
Puppet::Functions\.create_function\(.*, Puppet::Functions::InternalFunction\)
and generate different code if we find it. Also a bit hackish.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more an internal detail. Not sure we really need to spell it out to users. Just not break things for them! :)
Are we likely to be running the rake task anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smortex Now that I've updated the rake task to ignore this file, I've just got what you were getting at!