Puppet Function: unique_users

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

Overview

unique_users()Any

Returns:

  • (Any)


2
3
4
5
6
7
8
9
10
11
12
13
# File 'modules/admin/lib/puppet/parser/functions/unique_users.rb', line 2

newfunction(:unique_users, :arity => 2, :type => :rvalue) do |args|
    myhash, applied_groups = args

    users = []
    applied_groups.each do |group|
        if myhash['groups'].key?(group)
            users.push(myhash['groups'][group]['members'])
        end
    end

    users.flatten(2).uniq
end