summaryrefslogtreecommitdiff
path: root/lib/puppet/functions/is_ip_address.rb
diff options
context:
space:
mode:
authorDavid Schmitt <david.schmitt@puppet.com>2016-10-12 13:25:33 +0100
committerDavid Schmitt <david.schmitt@puppet.com>2016-10-12 13:25:33 +0100
commitf2741dc814c1b6c10d8dd69c17aabf5bae106c17 (patch)
tree8791cd53c7596a126912872b7e985342a671af6d /lib/puppet/functions/is_ip_address.rb
parent6fb746528dde4b6ee10eff4a008f76db6276bc2d (diff)
(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.
Diffstat (limited to 'lib/puppet/functions/is_ip_address.rb')
-rw-r--r--lib/puppet/functions/is_ip_address.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/puppet/functions/is_ip_address.rb b/lib/puppet/functions/is_ip_address.rb
index e584714..4c72037 100644
--- a/lib/puppet/functions/is_ip_address.rb
+++ b/lib/puppet/functions/is_ip_address.rb
@@ -1,7 +1,12 @@
-Puppet::Functions.create_function(:is_ip_address, Puppet::Functions::InternalFunction) do
+Puppet::Functions.create_function(:is_ip_address) 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_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.")