Puppet Function: icinga2_attributes

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

Summary

Wrapper for config parser

Overview

icinga2_attributes()Any

Returns:

  • (Any)

    Parsed config as string



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/puppet/parser/functions/icinga2_attributes.rb', line 10

newfunction(:icinga2_attributes, :type => :rvalue) do |args|
  raise Puppet::ParseError, 'icinga2_atributes(): Must provide at least one argument.' if args.length > 4 || args.length < 1

  if args[1]
    indent = args[1]
  else
    indent = 0
  end

  if args[2]
    globals = args[2].concat(lookupvar('::icinga2::_reserved'))
  else
    globals = lookupvar('::icinga2::_reserved')
  end

  if args[3]
    constants = args[3].merge(lookupvar('::icinga2::_constants'))
  else
    constants = lookupvar('::icinga2::_constants')
  end

  Puppet::Icinga2::Utils.attributes(args[0], globals, constants, indent)
end