Puppet Function: get_class_args

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

Overview

get_class_args()Any

This function will return all arguments passed to the current scope. This could be a class or defined resource.

Returns:

  • (Any)


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/puppet/parser/functions/get_class_args.rb', line 5

newfunction(:get_class_args, :type => :rvalue, :doc => <<-EOS
This function will return all arguments passed to the current scope. This could
be a class or defined resource.
  EOS
) do |arguments|
 
  if (arguments.size != 0) then
    raise(Puppet::ParseError, "validate_resource(): Wrong number of arguments "+
      "given #{arguments.size} for 0")
  end

  # Grab the current scope, turn it to a hash but do not be recursive 
  # about it.
  classhash = to_hash(recursive=false)

  # Strip bits that do not matter for validation
#    classhash.delete("name")
#    classhash.delete("title")
#    classhash.delete("caller_module_name")
#    classhash.delete("module_name")

  # Return munged classhash
  classhash
end