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/is_bool.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/puppet/functions/is_bool.rb') diff --git a/lib/puppet/functions/is_bool.rb b/lib/puppet/functions/is_bool.rb index ff1d462..6e2c22b 100644 --- a/lib/puppet/functions/is_bool.rb +++ b/lib/puppet/functions/is_bool.rb @@ -1,7 +1,12 @@ -Puppet::Functions.create_function(:is_bool, Puppet::Functions::InternalFunction) do +Puppet::Functions.create_function(:is_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', '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.") -- cgit v1.2.3