Skip to content

Commit aabcbb0

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 f7dd14a commit aabcbb0

21 files changed

+21
-21
lines changed

Rakefile

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

lib/puppet/functions/seeded_rand_string.rb

+1-1
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_string', 'This function is deprecated, please use stdlib::seeded_rand_string instead.')
11+
call_function('deprecation', 'seeded_rand_string', 'This function is deprecated, please use stdlib::seeded_rand_string instead.', false)
1212
call_function('stdlib::seeded_rand_string', *args)
1313
end
1414
end

lib/puppet/functions/shell_escape.rb

+1-1
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', 'shell_escape', 'This function is deprecated, please use stdlib::shell_escape instead.')
11+
call_function('deprecation', 'shell_escape', 'This function is deprecated, please use stdlib::shell_escape instead.', false)
1212
call_function('stdlib::shell_escape', *args)
1313
end
1414
end

lib/puppet/functions/to_json.rb

+1-1
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', 'to_json', 'This function is deprecated, please use stdlib::to_json instead.')
11+
call_function('deprecation', 'to_json', 'This function is deprecated, please use stdlib::to_json instead.', false)
1212
call_function('stdlib::to_json', *args)
1313
end
1414
end

lib/puppet/functions/to_json_pretty.rb

+1-1
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', 'to_json_pretty', 'This function is deprecated, please use stdlib::to_json_pretty instead.')
11+
call_function('deprecation', 'to_json_pretty', 'This function is deprecated, please use stdlib::to_json_pretty instead.', false)
1212
call_function('stdlib::to_json_pretty', *args)
1313
end
1414
end

lib/puppet/functions/to_python.rb

+1-1
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', 'to_python', 'This function is deprecated, please use stdlib::to_python instead.')
11+
call_function('deprecation', 'to_python', 'This function is deprecated, please use stdlib::to_python instead.', false)
1212
call_function('stdlib::to_python', *args)
1313
end
1414
end

lib/puppet/functions/to_ruby.rb

+1-1
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', 'to_ruby', 'This function is deprecated, please use stdlib::to_ruby instead.')
11+
call_function('deprecation', 'to_ruby', 'This function is deprecated, please use stdlib::to_ruby instead.', false)
1212
call_function('stdlib::to_ruby', *args)
1313
end
1414
end

lib/puppet/functions/to_toml.rb

+1-1
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', 'to_toml', 'This function is deprecated, please use stdlib::to_toml instead.')
11+
call_function('deprecation', 'to_toml', 'This function is deprecated, please use stdlib::to_toml instead.', false)
1212
call_function('stdlib::to_toml', *args)
1313
end
1414
end

lib/puppet/functions/to_yaml.rb

+1-1
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', 'to_yaml', 'This function is deprecated, please use stdlib::to_yaml instead.')
11+
call_function('deprecation', 'to_yaml', 'This function is deprecated, please use stdlib::to_yaml instead.', false)
1212
call_function('stdlib::to_yaml', *args)
1313
end
1414
end

lib/puppet/functions/type_of.rb

+1-1
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', 'type_of', 'This function is deprecated, please use stdlib::type_of instead.')
11+
call_function('deprecation', 'type_of', 'This function is deprecated, please use stdlib::type_of instead.', false)
1212
call_function('stdlib::type_of', *args)
1313
end
1414
end

lib/puppet/functions/validate_domain_name.rb

+1-1
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', 'validate_domain_name', 'This function is deprecated, please use stdlib::validate_domain_name instead.')
11+
call_function('deprecation', 'validate_domain_name', 'This function is deprecated, please use stdlib::validate_domain_name instead.', false)
1212
call_function('stdlib::validate_domain_name', *args)
1313
end
1414
end

lib/puppet/functions/validate_email_address.rb

+1-1
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', 'validate_email_address', 'This function is deprecated, please use stdlib::validate_email_address instead.')
11+
call_function('deprecation', 'validate_email_address', 'This function is deprecated, please use stdlib::validate_email_address instead.', false)
1212
call_function('stdlib::validate_email_address', *args)
1313
end
1414
end

0 commit comments

Comments
 (0)