Skip to content

Commit 3df8f0c

Browse files
Merge pull request #1366 from alexjfisher/issue1365
Pass calling scope to `stdlib::ensure_packages` from shim
2 parents 44b6065 + a68c958 commit 3df8f0c

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

Rakefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,16 @@ task :regenerate_unamespaced_shims do
9292
Dir['lib/puppet/functions/*.rb'].each do |filename|
9393
content = File.read(filename)
9494

95-
unless content =~ /@summary DEPRECATED. Use the namespaced function/
95+
unless content =~ /@summary DEPRECATED\. Use the namespaced function/
9696
warn("#{filename} does not look like a deprecation shim (skipping)")
9797
next
9898
end
9999

100+
if content =~ /InternalFunction/
101+
warn("#{filename} is a special case. Not regenerating a shim for this file")
102+
next
103+
end
104+
100105
function_name = File.basename(filename, '.rb')
101106

102107
File.write(filename, <<~CODE)
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# frozen_string_literal: true
22

3-
# THIS FILE WAS GENERATED BY `rake regenerate_unamespaced_shims`
4-
53
# @summary DEPRECATED. Use the namespaced function [`stdlib::ensure_packages`](#stdlibensure_packages) instead.
6-
Puppet::Functions.create_function(:ensure_packages) do
4+
Puppet::Functions.create_function(:ensure_packages, Puppet::Functions::InternalFunction) do
75
dispatch :deprecation_gen do
6+
scope_param
87
repeated_param 'Any', :args
98
end
10-
def deprecation_gen(*args)
9+
def deprecation_gen(scope, *args)
1110
call_function('deprecation', 'ensure_packages', 'This function is deprecated, please use stdlib::ensure_packages instead.')
12-
call_function('stdlib::ensure_packages', *args)
11+
scope.call_function('stdlib::ensure_packages', args)
1312
end
1413
end

0 commit comments

Comments
 (0)