From 0ec7ffa5c086c8a1c6e871b086299dd1953fa8ba Mon Sep 17 00:00:00 2001 From: Helen Campbell Date: Thu, 15 Sep 2016 11:35:38 +0100 Subject: Ensure validate functions use Puppet 4 deprecation --- lib/puppet/functions/validate_bool.rb | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 lib/puppet/functions/validate_bool.rb (limited to 'lib/puppet/functions/validate_bool.rb') diff --git a/lib/puppet/functions/validate_bool.rb b/lib/puppet/functions/validate_bool.rb new file mode 100644 index 0000000..10f6edf --- /dev/null +++ b/lib/puppet/functions/validate_bool.rb @@ -0,0 +1,3 @@ +require 'puppet_x/puppetlabs/stdlib/deprecation_gen' +PuppetX::Puppetlabs::Stdlib.deprecation_gen("validate_bool", "Stdlib::Compat::Bool") +# Puppet::Functions.create_function -- cgit v1.2.3 From 69c69e750bdaee7d5eec264650551b149538de92 Mon Sep 17 00:00:00 2001 From: Helen Date: Wed, 21 Sep 2016 16:22:37 +0100 Subject: Revert "Ensure validate functions use Puppet 4 deprecation" --- lib/puppet/functions/validate_bool.rb | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 lib/puppet/functions/validate_bool.rb (limited to 'lib/puppet/functions/validate_bool.rb') diff --git a/lib/puppet/functions/validate_bool.rb b/lib/puppet/functions/validate_bool.rb deleted file mode 100644 index 10f6edf..0000000 --- a/lib/puppet/functions/validate_bool.rb +++ /dev/null @@ -1,3 +0,0 @@ -require 'puppet_x/puppetlabs/stdlib/deprecation_gen' -PuppetX::Puppetlabs::Stdlib.deprecation_gen("validate_bool", "Stdlib::Compat::Bool") -# Puppet::Functions.create_function -- cgit v1.2.3 From 970852dd317fbb2699b406dd25aeddef496a7c92 Mon Sep 17 00:00:00 2001 From: Helen Campbell Date: Mon, 3 Oct 2016 14:10:50 +0100 Subject: Addition of Puppet 4 functions --- lib/puppet/functions/validate_bool.rb | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 lib/puppet/functions/validate_bool.rb (limited to 'lib/puppet/functions/validate_bool.rb') diff --git a/lib/puppet/functions/validate_bool.rb b/lib/puppet/functions/validate_bool.rb new file mode 100644 index 0000000..10f6edf --- /dev/null +++ b/lib/puppet/functions/validate_bool.rb @@ -0,0 +1,3 @@ +require 'puppet_x/puppetlabs/stdlib/deprecation_gen' +PuppetX::Puppetlabs::Stdlib.deprecation_gen("validate_bool", "Stdlib::Compat::Bool") +# Puppet::Functions.create_function -- cgit v1.2.3 From a4ebae621dd4dc09d760a51b8b221a3250142789 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Fri, 7 Oct 2016 13:00:06 +0100 Subject: (FM-5703, PUP-6717) Remove the dynamic deprecation_gen This was not working when the puppet master did not have the newest stdlib version in its environment. --- lib/puppet/functions/validate_bool.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/puppet/functions/validate_bool.rb') diff --git a/lib/puppet/functions/validate_bool.rb b/lib/puppet/functions/validate_bool.rb index 10f6edf..168775d 100644 --- a/lib/puppet/functions/validate_bool.rb +++ b/lib/puppet/functions/validate_bool.rb @@ -1,3 +1,10 @@ -require 'puppet_x/puppetlabs/stdlib/deprecation_gen' -PuppetX::Puppetlabs::Stdlib.deprecation_gen("validate_bool", "Stdlib::Compat::Bool") -# Puppet::Functions.create_function +Puppet::Functions.create_function(:validate_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', '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.") + scope.send("function_validate_bool", args) + end +end -- cgit v1.2.3 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/validate_bool.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet/functions/validate_bool.rb') 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 -- cgit v1.2.3 From f2741dc814c1b6c10d8dd69c17aabf5bae106c17 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Wed, 12 Oct 2016 13:25:33 +0100 Subject: (MODULES-3962) Rework v4 function shims to work on puppet 3.7 and 4.0.0 This is a workaround for PUP-4438 (fixed in https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08, 4.1.0, 3.8.1). It works by manually passing through the scope, instead of relying on the InternalFunction class. --- lib/puppet/functions/validate_bool.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/puppet/functions/validate_bool.rb') diff --git a/lib/puppet/functions/validate_bool.rb b/lib/puppet/functions/validate_bool.rb index 9d68cc9..5cfb2ac 100644 --- a/lib/puppet/functions/validate_bool.rb +++ b/lib/puppet/functions/validate_bool.rb @@ -1,7 +1,12 @@ -Puppet::Functions.create_function(:validate_bool, Puppet::Functions::InternalFunction) do +Puppet::Functions.create_function(:validate_bool) do dispatch :deprecation_gen do - scope_param - optional_repeated_param 'Any', :args + param 'Any', :scope + repeated_param 'Any', :args + end + # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff-c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1. + def call(scope, *args) + manipulated_args = [scope] + args + self.class.dispatcher.dispatch(self, scope, manipulated_args) end def deprecation_gen(scope, *args) 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.") -- cgit v1.2.3