Puppet Function: inspect

Defined in:
lib/puppet/parser/functions/inspect.rb
Function type:
Ruby 3.x API

Overview

inspect()N

Prints out Puppet warning messages that display the passed variable.

This is mainly meant for debugging purposes.

Returns:

  • (N)

    N



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/puppet/parser/functions/inspect.rb', line 2

newfunction(:inspect, :doc => <<-EOM) do |args|

  if (args.size != 1)
  Prints out Puppet warning messages that display the passed variable.

  This is mainly meant for debugging purposes.

  @return [Nil]
  EOM
    raise(Puppet::ParseError, "inspect(): Wrong number of arguments "+
      "given #{args.size} for 1")
  end

  puts("Inspect: Type => '#{args.first.class}' Content => '#{args.first.to_pson}'")
  Puppet.warning("Inspect: Type => '#{args.first.class}' Content => '#{args.first.to_pson}'")
end