From b92fad2b7667df836f8ca4eb92d8c8be84bd0538 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Wed, 12 Oct 2016 10:04:54 +0100 Subject: (MODULES-3961) emit more deprecation warnings This now emits one deprecation warning for each function used (but not for each call-site). Prior to this, only a single deprecation warning would have been triggered, potentially misleading users. Additionally this adds v4 deprecation stubs for the functions that were missed. --- lib/puppet/functions/is_absolute_path.rb | 10 ++++++++++ lib/puppet/functions/is_array.rb | 10 ++++++++++ lib/puppet/functions/is_bool.rb | 10 ++++++++++ lib/puppet/functions/is_float.rb | 10 ++++++++++ lib/puppet/functions/is_ip_address.rb | 10 ++++++++++ lib/puppet/functions/is_ipv4_address.rb | 10 ++++++++++ lib/puppet/functions/is_ipv6_address.rb | 10 ++++++++++ lib/puppet/functions/is_numeric.rb | 10 ++++++++++ lib/puppet/functions/is_string.rb | 10 ++++++++++ lib/puppet/functions/validate_absolute_path.rb | 2 +- lib/puppet/functions/validate_array.rb | 2 +- lib/puppet/functions/validate_bool.rb | 2 +- lib/puppet/functions/validate_hash.rb | 2 +- lib/puppet/functions/validate_integer.rb | 2 +- lib/puppet/functions/validate_ip_address.rb | 2 +- lib/puppet/functions/validate_ipv4_address.rb | 2 +- lib/puppet/functions/validate_ipv6_address.rb | 2 +- lib/puppet/functions/validate_numeric.rb | 2 +- lib/puppet/functions/validate_re.rb | 2 +- lib/puppet/functions/validate_slength.rb | 2 +- lib/puppet/functions/validate_string.rb | 2 +- 21 files changed, 102 insertions(+), 12 deletions(-) create mode 100644 lib/puppet/functions/is_absolute_path.rb create mode 100644 lib/puppet/functions/is_array.rb create mode 100644 lib/puppet/functions/is_bool.rb create mode 100644 lib/puppet/functions/is_float.rb create mode 100644 lib/puppet/functions/is_ip_address.rb create mode 100644 lib/puppet/functions/is_ipv4_address.rb create mode 100644 lib/puppet/functions/is_ipv6_address.rb create mode 100644 lib/puppet/functions/is_numeric.rb create mode 100644 lib/puppet/functions/is_string.rb (limited to 'lib/puppet/functions') diff --git a/lib/puppet/functions/is_absolute_path.rb b/lib/puppet/functions/is_absolute_path.rb new file mode 100644 index 0000000..0a100f8 --- /dev/null +++ b/lib/puppet/functions/is_absolute_path.rb @@ -0,0 +1,10 @@ +Puppet::Functions.create_function(:is_absolute_path, Puppet::Functions::InternalFunction) do + dispatch :deprecation_gen do + scope_param + optional_repeated_param 'Any', :args + end + def deprecation_gen(scope, *args) + call_function('deprecation', 'is_absolute_path', "This method is deprecated, please use match expressions with Stdlib::Compat::Absolute_Path instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.") + scope.send("function_is_absolute_path", args) + end +end diff --git a/lib/puppet/functions/is_array.rb b/lib/puppet/functions/is_array.rb new file mode 100644 index 0000000..0542a63 --- /dev/null +++ b/lib/puppet/functions/is_array.rb @@ -0,0 +1,10 @@ +Puppet::Functions.create_function(:is_array, Puppet::Functions::InternalFunction) do + dispatch :deprecation_gen do + scope_param + optional_repeated_param 'Any', :args + end + def deprecation_gen(scope, *args) + call_function('deprecation', 'is_array', "This method is deprecated, please use match expressions with Stdlib::Compat::Array instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.") + scope.send("function_is_array", args) + end +end diff --git a/lib/puppet/functions/is_bool.rb b/lib/puppet/functions/is_bool.rb new file mode 100644 index 0000000..ff1d462 --- /dev/null +++ b/lib/puppet/functions/is_bool.rb @@ -0,0 +1,10 @@ +Puppet::Functions.create_function(:is_bool, Puppet::Functions::InternalFunction) do + dispatch :deprecation_gen do + scope_param + optional_repeated_param 'Any', :args + end + def deprecation_gen(scope, *args) + call_function('deprecation', 'is_bool', "This method is deprecated, please use match expressions with Stdlib::Compat::Bool instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.") + scope.send("function_is_bool", args) + end +end diff --git a/lib/puppet/functions/is_float.rb b/lib/puppet/functions/is_float.rb new file mode 100644 index 0000000..b3763f2 --- /dev/null +++ b/lib/puppet/functions/is_float.rb @@ -0,0 +1,10 @@ +Puppet::Functions.create_function(:is_float, Puppet::Functions::InternalFunction) do + dispatch :deprecation_gen do + scope_param + optional_repeated_param 'Any', :args + end + def deprecation_gen(scope, *args) + call_function('deprecation', 'is_float', "This method is deprecated, please use match expressions with Stdlib::Compat::Float instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.") + scope.send("function_is_float", args) + end +end diff --git a/lib/puppet/functions/is_ip_address.rb b/lib/puppet/functions/is_ip_address.rb new file mode 100644 index 0000000..e584714 --- /dev/null +++ b/lib/puppet/functions/is_ip_address.rb @@ -0,0 +1,10 @@ +Puppet::Functions.create_function(:is_ip_address, Puppet::Functions::InternalFunction) do + dispatch :deprecation_gen do + scope_param + optional_repeated_param 'Any', :args + end + def deprecation_gen(scope, *args) + call_function('deprecation', 'is_ip_address', "This method is deprecated, please use match expressions with Stdlib::Compat::Ip_address instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.") + scope.send("function_is_ip_address", args) + end +end diff --git a/lib/puppet/functions/is_ipv4_address.rb b/lib/puppet/functions/is_ipv4_address.rb new file mode 100644 index 0000000..76c75e5 --- /dev/null +++ b/lib/puppet/functions/is_ipv4_address.rb @@ -0,0 +1,10 @@ +Puppet::Functions.create_function(:is_ipv4_address, Puppet::Functions::InternalFunction) do + dispatch :deprecation_gen do + scope_param + optional_repeated_param 'Any', :args + end + def deprecation_gen(scope, *args) + call_function('deprecation', 'is_ipv4_address', "This method is deprecated, please use match expressions with Stdlib::Compat::Ipv4 instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.") + scope.send("function_is_ipv4_address", args) + end +end diff --git a/lib/puppet/functions/is_ipv6_address.rb b/lib/puppet/functions/is_ipv6_address.rb new file mode 100644 index 0000000..dbf5282 --- /dev/null +++ b/lib/puppet/functions/is_ipv6_address.rb @@ -0,0 +1,10 @@ +Puppet::Functions.create_function(:is_ipv6_address, Puppet::Functions::InternalFunction) do + dispatch :deprecation_gen do + scope_param + optional_repeated_param 'Any', :args + end + def deprecation_gen(scope, *args) + call_function('deprecation', 'is_ipv4_address', "This method is deprecated, please use match expressions with Stdlib::Compat::Ipv6 instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.") + scope.send("function_is_ipv6_address", args) + end +end diff --git a/lib/puppet/functions/is_numeric.rb b/lib/puppet/functions/is_numeric.rb new file mode 100644 index 0000000..3a0f0cd --- /dev/null +++ b/lib/puppet/functions/is_numeric.rb @@ -0,0 +1,10 @@ +Puppet::Functions.create_function(:is_numeric, Puppet::Functions::InternalFunction) do + dispatch :deprecation_gen do + scope_param + optional_repeated_param 'Any', :args + end + def deprecation_gen(scope, *args) + call_function('deprecation', 'is_numeric', "This method is deprecated, please use match expressions with Stdlib::Compat::Numeric instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.") + scope.send("function_is_numeric", args) + end +end diff --git a/lib/puppet/functions/is_string.rb b/lib/puppet/functions/is_string.rb new file mode 100644 index 0000000..4978284 --- /dev/null +++ b/lib/puppet/functions/is_string.rb @@ -0,0 +1,10 @@ +Puppet::Functions.create_function(:is_string, Puppet::Functions::InternalFunction) do + dispatch :deprecation_gen do + scope_param + optional_repeated_param 'Any', :args + end + def deprecation_gen(scope, *args) + call_function('deprecation', 'is_string', "This method is deprecated, please use match expressions with Stdlib::Compat::String instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.") + scope.send("function_is_string", args) + end +end diff --git a/lib/puppet/functions/validate_absolute_path.rb b/lib/puppet/functions/validate_absolute_path.rb index 94f52e1..946ff31 100644 --- a/lib/puppet/functions/validate_absolute_path.rb +++ b/lib/puppet/functions/validate_absolute_path.rb @@ -4,7 +4,7 @@ Puppet::Functions.create_function(:validate_absolute_path, Puppet::Functions::In optional_repeated_param 'Any', :args end def deprecation_gen(scope, *args) - call_function('deprecation', 'puppet_3_type_check', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Absolute_Path. There is further documentation for validate_legacy function in the README.") + call_function('deprecation', 'validate_absolute_path', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Absolute_Path. There is further documentation for validate_legacy function in the README.") scope.send("function_validate_absolute_path", args) end end diff --git a/lib/puppet/functions/validate_array.rb b/lib/puppet/functions/validate_array.rb index eb8f5e5..c8553c4 100644 --- a/lib/puppet/functions/validate_array.rb +++ b/lib/puppet/functions/validate_array.rb @@ -4,7 +4,7 @@ Puppet::Functions.create_function(:validate_array, Puppet::Functions::InternalFu optional_repeated_param 'Any', :args end def deprecation_gen(scope, *args) - call_function('deprecation', 'puppet_3_type_check', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Array. There is further documentation for validate_legacy function in the README.") + call_function('deprecation', 'validate_array', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Array. There is further documentation for validate_legacy function in the README.") scope.send("function_validate_array", args) end end diff --git a/lib/puppet/functions/validate_bool.rb b/lib/puppet/functions/validate_bool.rb index 168775d..9d68cc9 100644 --- a/lib/puppet/functions/validate_bool.rb +++ b/lib/puppet/functions/validate_bool.rb @@ -4,7 +4,7 @@ Puppet::Functions.create_function(:validate_bool, Puppet::Functions::InternalFun optional_repeated_param 'Any', :args end def deprecation_gen(scope, *args) - call_function('deprecation', 'puppet_3_type_check', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Bool. There is further documentation for validate_legacy function in the README.") + call_function('deprecation', 'validate_bool', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Bool. There is further documentation for validate_legacy function in the README.") scope.send("function_validate_bool", args) end end diff --git a/lib/puppet/functions/validate_hash.rb b/lib/puppet/functions/validate_hash.rb index c356ceb..fdd8e01 100644 --- a/lib/puppet/functions/validate_hash.rb +++ b/lib/puppet/functions/validate_hash.rb @@ -4,7 +4,7 @@ Puppet::Functions.create_function(:validate_hash, Puppet::Functions::InternalFun optional_repeated_param 'Any', :args end def deprecation_gen(scope, *args) - call_function('deprecation', 'puppet_3_type_check', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Hash. There is further documentation for validate_legacy function in the README.") + call_function('deprecation', 'validate_hash', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Hash. There is further documentation for validate_legacy function in the README.") scope.send("function_validate_hash", args) end end diff --git a/lib/puppet/functions/validate_integer.rb b/lib/puppet/functions/validate_integer.rb index db95f1c..63a3523 100644 --- a/lib/puppet/functions/validate_integer.rb +++ b/lib/puppet/functions/validate_integer.rb @@ -4,7 +4,7 @@ Puppet::Functions.create_function(:validate_integer, Puppet::Functions::Internal optional_repeated_param 'Any', :args end def deprecation_gen(scope, *args) - call_function('deprecation', 'puppet_3_type_check', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Integer. There is further documentation for validate_legacy function in the README.") + call_function('deprecation', 'validate_integer', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Integer. There is further documentation for validate_legacy function in the README.") scope.send("function_validate_integer", args) end end diff --git a/lib/puppet/functions/validate_ip_address.rb b/lib/puppet/functions/validate_ip_address.rb index eaf56bb..c9c52bb 100644 --- a/lib/puppet/functions/validate_ip_address.rb +++ b/lib/puppet/functions/validate_ip_address.rb @@ -4,7 +4,7 @@ Puppet::Functions.create_function(:validate_ip_address, Puppet::Functions::Inter optional_repeated_param 'Any', :args end def deprecation_gen(scope, *args) - call_function('deprecation', 'puppet_3_type_check', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Ip_Address. There is further documentation for validate_legacy function in the README.") + call_function('deprecation', 'validate_ip_address', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Ip_Address. There is further documentation for validate_legacy function in the README.") scope.send("function_validate_ip_address", args) end end diff --git a/lib/puppet/functions/validate_ipv4_address.rb b/lib/puppet/functions/validate_ipv4_address.rb index 6a870eb..d501f7a 100644 --- a/lib/puppet/functions/validate_ipv4_address.rb +++ b/lib/puppet/functions/validate_ipv4_address.rb @@ -4,7 +4,7 @@ Puppet::Functions.create_function(:validate_ipv4_address, Puppet::Functions::Int optional_repeated_param 'Any', :args end def deprecation_gen(scope, *args) - call_function('deprecation', 'puppet_3_type_check', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Ipv4_Address. There is further documentation for validate_legacy function in the README.") + call_function('deprecation', 'validate_ipv4_address', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Ipv4_Address. There is further documentation for validate_legacy function in the README.") scope.send("function_validate_ipv4_address", args) end end diff --git a/lib/puppet/functions/validate_ipv6_address.rb b/lib/puppet/functions/validate_ipv6_address.rb index 922a9ac..aa8044f 100644 --- a/lib/puppet/functions/validate_ipv6_address.rb +++ b/lib/puppet/functions/validate_ipv6_address.rb @@ -4,7 +4,7 @@ Puppet::Functions.create_function(:validate_ipv6_address, Puppet::Functions::Int optional_repeated_param 'Any', :args end def deprecation_gen(scope, *args) - call_function('deprecation', 'puppet_3_type_check', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Ipv6_address. There is further documentation for validate_legacy function in the README.") + call_function('deprecation', 'validate_ipv6_address', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Ipv6_address. There is further documentation for validate_legacy function in the README.") scope.send("function_validate_ipv6_address", args) end end diff --git a/lib/puppet/functions/validate_numeric.rb b/lib/puppet/functions/validate_numeric.rb index e48bec4..7db5c90 100644 --- a/lib/puppet/functions/validate_numeric.rb +++ b/lib/puppet/functions/validate_numeric.rb @@ -4,7 +4,7 @@ Puppet::Functions.create_function(:validate_numeric, Puppet::Functions::Internal optional_repeated_param 'Any', :args end def deprecation_gen(scope, *args) - call_function('deprecation', 'puppet_3_type_check', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Numeric. There is further documentation for validate_legacy function in the README.") + call_function('deprecation', 'validate_numeric', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Numeric. There is further documentation for validate_legacy function in the README.") scope.send("function_validate_numeric", args) end end diff --git a/lib/puppet/functions/validate_re.rb b/lib/puppet/functions/validate_re.rb index 8a95077..ae5d9f1 100644 --- a/lib/puppet/functions/validate_re.rb +++ b/lib/puppet/functions/validate_re.rb @@ -4,7 +4,7 @@ Puppet::Functions.create_function(:validate_re, Puppet::Functions::InternalFunct optional_repeated_param 'Any', :args end def deprecation_gen(scope, *args) - call_function('deprecation', 'puppet_3_type_check', "This method is deprecated, please use the stdlib validate_legacy function, with Pattern[]. There is further documentation for validate_legacy function in the README.") + call_function('deprecation', 'validate_re', "This method is deprecated, please use the stdlib validate_legacy function, with Pattern[]. There is further documentation for validate_legacy function in the README.") scope.send("function_validate_re", args) end end diff --git a/lib/puppet/functions/validate_slength.rb b/lib/puppet/functions/validate_slength.rb index 2d71a14..c3c29a5 100644 --- a/lib/puppet/functions/validate_slength.rb +++ b/lib/puppet/functions/validate_slength.rb @@ -4,7 +4,7 @@ Puppet::Functions.create_function(:validate_slength, Puppet::Functions::Internal optional_repeated_param 'Any', :args end def deprecation_gen(scope, *args) - call_function('deprecation', 'puppet_3_type_check', "This method is deprecated, please use the stdlib validate_legacy function, with String[]. There is further documentation for validate_legacy function in the README.") + call_function('deprecation', 'validate_slength', "This method is deprecated, please use the stdlib validate_legacy function, with String[]. There is further documentation for validate_legacy function in the README.") scope.send("function_validate_slength", args) end end diff --git a/lib/puppet/functions/validate_string.rb b/lib/puppet/functions/validate_string.rb index fe4c623..9b0b731 100644 --- a/lib/puppet/functions/validate_string.rb +++ b/lib/puppet/functions/validate_string.rb @@ -4,7 +4,7 @@ Puppet::Functions.create_function(:validate_string, Puppet::Functions::InternalF optional_repeated_param 'Any', :args end def deprecation_gen(scope, *args) - call_function('deprecation', 'puppet_3_type_check', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::String. There is further documentation for validate_legacy function in the README.") + call_function('deprecation', 'validate_string', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::String. There is further documentation for validate_legacy function in the README.") scope.send("function_validate_string", args) end end -- cgit v1.2.3