Puppet Function: portablehomes_excluded_items

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

Overview

portablehomes_excluded_items()Any

Returns a Array of properly formatted excludeItems Hashes.

Returns:

  • (Any)


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/puppet/parser/functions/portablehomes_excluded_items.rb', line 2

newfunction(:portablehomes_excluded_items, :type => :rvalue, :doc => <<-EOS
Returns a Array of properly formatted excludeItems Hashes.
  EOS
) do |args|

  if args.size != 1
    e = "portablehomes_excluded_items(): Too many args! (#{args.size} instead of 1)"
    raise(Puppet::ParseError, e)
  end

  unless args[0].is_a? Hash
    e = "portablehomes_excluded_items(): Wrong arg type! (#{args[0].class} instead of Hash)"
    raise(Puppet::ParseError, e)
  end

  args[0].inject([]) do |memo,(k,v)|
    v.each do |p|
      memo << {'comparison' => k, 'value' => p}
    end
    memo
  end

end