Puppet Function: extlib::dump_args

Defined in:
lib/puppet/functions/extlib/dump_args.rb
Function type:
Ruby 4.x API

Summary

Prints the args to STDOUT in Pretty JSON format.

Overview

extlib::dump_args(Any $args)Undef

Prints the args to STDOUT in Pretty JSON format.

Useful for debugging purposes only. Ideally you would use this in conjunction with a rspec-puppet unit test. Otherwise the output will be shown during a puppet run when verbose/debug options are enabled.

Parameters:

  • args (Any)

    The data you want to dump as pretty JSON.

Returns:

  • (Undef)

    Returns nothing.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/puppet/functions/extlib/dump_args.rb', line 12

Puppet::Functions.create_function(:'extlib::dump_args') do
  # @param args The data you want to dump as pretty JSON.
  # @return [Undef] Returns nothing.
  dispatch :dump_args do
    param 'Any', :args
  end

  def dump_args(args)
    puts JSON.pretty_generate(args)
  end
end