Skip to content

Commit 2760ee6

Browse files
committed
Ignore Puppet's strict setting when calling function without namespace
Previously, when a user had the Puppet setting `strict` set to `error` (which is the default in Puppet 8), a call to one of stdlib's functions via the deprecated non-namespaced function would cause a hard failure instead of just logging a warning and calling the real namespaced function. In this change, all of our shims have been updated to call `deprecation` with its new third parameter, (`use_strict_setting`), set to `false`. The non-namespaced versions will now only ever log warnings informing users to moved to the namespaced versions. It will not raise exceptions even if `strict` is set to `error`. This change will make it much easier for users to migrate to stdlib 9 (and to upgrade modules that now depend on stdlib 9) Fixes #1373
1 parent 4b64d06 commit 2760ee6

21 files changed

+21
-21
lines changed

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ task :regenerate_unamespaced_shims do
115115
repeated_param 'Any', :args
116116
end
117117
def deprecation_gen(*args)
118-
call_function('deprecation', '#{function_name}', 'This function is deprecated, please use stdlib::#{function_name} instead.')
118+
call_function('deprecation', '#{function_name}', 'This function is deprecated, please use stdlib::#{function_name} instead.', false)
119119
call_function('stdlib::#{function_name}', *args)
120120
end
121121
end

lib/puppet/functions/batch_escape.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
repeated_param 'Any', :args
99
end
1010
def deprecation_gen(*args)
11-
call_function('deprecation', 'batch_escape', 'This function is deprecated, please use stdlib::batch_escape instead.')
11+
call_function('deprecation', 'batch_escape', 'This function is deprecated, please use stdlib::batch_escape instead.', false)
1212
call_function('stdlib::batch_escape', *args)
1313
end
1414
end

lib/puppet/functions/ensure_packages.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
repeated_param 'Any', :args
88
end
99
def deprecation_gen(scope, *args)
10-
call_function('deprecation', 'ensure_packages', 'This function is deprecated, please use stdlib::ensure_packages instead.')
10+
call_function('deprecation', 'ensure_packages', 'This function is deprecated, please use stdlib::ensure_packages instead.', false)
1111
scope.call_function('stdlib::ensure_packages', args)
1212
end
1313
end

lib/puppet/functions/fqdn_rand_string.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
repeated_param 'Any', :args
99
end
1010
def deprecation_gen(*args)
11-
call_function('deprecation', 'fqdn_rand_string', 'This function is deprecated, please use stdlib::fqdn_rand_string instead.')
11+
call_function('deprecation', 'fqdn_rand_string', 'This function is deprecated, please use stdlib::fqdn_rand_string instead.', false)
1212
call_function('stdlib::fqdn_rand_string', *args)
1313
end
1414
end

lib/puppet/functions/has_interface_with.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
repeated_param 'Any', :args
99
end
1010
def deprecation_gen(*args)
11-
call_function('deprecation', 'has_interface_with', 'This function is deprecated, please use stdlib::has_interface_with instead.')
11+
call_function('deprecation', 'has_interface_with', 'This function is deprecated, please use stdlib::has_interface_with instead.', false)
1212
call_function('stdlib::has_interface_with', *args)
1313
end
1414
end

lib/puppet/functions/merge.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
repeated_param 'Any', :args
99
end
1010
def deprecation_gen(*args)
11-
call_function('deprecation', 'merge', 'This function is deprecated, please use stdlib::merge instead.')
11+
call_function('deprecation', 'merge', 'This function is deprecated, please use stdlib::merge instead.', false)
1212
call_function('stdlib::merge', *args)
1313
end
1414
end

lib/puppet/functions/os_version_gte.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
repeated_param 'Any', :args
99
end
1010
def deprecation_gen(*args)
11-
call_function('deprecation', 'os_version_gte', 'This function is deprecated, please use stdlib::os_version_gte instead.')
11+
call_function('deprecation', 'os_version_gte', 'This function is deprecated, please use stdlib::os_version_gte instead.', false)
1212
call_function('stdlib::os_version_gte', *args)
1313
end
1414
end

lib/puppet/functions/parsehocon.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
repeated_param 'Any', :args
99
end
1010
def deprecation_gen(*args)
11-
call_function('deprecation', 'parsehocon', 'This function is deprecated, please use stdlib::parsehocon instead.')
11+
call_function('deprecation', 'parsehocon', 'This function is deprecated, please use stdlib::parsehocon instead.', false)
1212
call_function('stdlib::parsehocon', *args)
1313
end
1414
end

lib/puppet/functions/powershell_escape.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
repeated_param 'Any', :args
99
end
1010
def deprecation_gen(*args)
11-
call_function('deprecation', 'powershell_escape', 'This function is deprecated, please use stdlib::powershell_escape instead.')
11+
call_function('deprecation', 'powershell_escape', 'This function is deprecated, please use stdlib::powershell_escape instead.', false)
1212
call_function('stdlib::powershell_escape', *args)
1313
end
1414
end

lib/puppet/functions/seeded_rand.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
repeated_param 'Any', :args
99
end
1010
def deprecation_gen(*args)
11-
call_function('deprecation', 'seeded_rand', 'This function is deprecated, please use stdlib::seeded_rand instead.')
11+
call_function('deprecation', 'seeded_rand', 'This function is deprecated, please use stdlib::seeded_rand instead.', false)
1212
call_function('stdlib::seeded_rand', *args)
1313
end
1414
end

0 commit comments

Comments
 (0)