diff modules/stdlib/lib/puppet/functions/sprintf_hash.rb @ 275:d9352a684e62

Mass update of modules to remove deprecation warnings
author IBBoard <dev@ibboard.co.uk>
date Sun, 26 Jan 2020 11:36:07 +0000
parents c42fb28cff86
children
line wrap: on
line diff
--- a/modules/stdlib/lib/puppet/functions/sprintf_hash.rb	Sat Jan 04 11:42:45 2020 +0000
+++ b/modules/stdlib/lib/puppet/functions/sprintf_hash.rb	Sun Jan 26 11:36:07 2020 +0000
@@ -1,4 +1,5 @@
-# Uses sprintf with named references.
+# @summary
+#  Uses sprintf with named references.
 #
 # The first parameter is format string describing how the rest of the parameters in the hash
 # should be formatted. See the documentation for the `Kernel::sprintf` function in Ruby for
@@ -12,6 +13,9 @@
 #                          { 'foo' => 'a string', 'number' => 5 })
 #   # $output = 'String: a string / number converted to binary: 101'
 #
+# Note that since Puppet 4.10.10, and 5.3.4 this functionality is supported by the
+# `sprintf` function in puppet core.
+#
 Puppet::Functions.create_function(:sprintf_hash) do
   # @param format The format to use.
   # @param arguments Hash with parameters.
@@ -24,6 +28,8 @@
   end
 
   def sprintf_hash(format, arguments)
+    call_function('deprecation', 'sprintf_hash', 'This method is deprecated. From Puppet 4.10.10/5.3.4 please use the built-in sprintf instead')
+
     Kernel.sprintf(format, Hash[arguments.map { |(k, v)| [k.to_sym, v] }])
   end
 end