aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mga_common
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mga_common')
-rw-r--r--modules/mga_common/lib/puppet/parser/functions/group_members.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/mga_common/lib/puppet/parser/functions/group_members.rb b/modules/mga_common/lib/puppet/parser/functions/group_members.rb
index 0324adb2..ea275be2 100644
--- a/modules/mga_common/lib/puppet/parser/functions/group_members.rb
+++ b/modules/mga_common/lib/puppet/parser/functions/group_members.rb
@@ -1,10 +1,14 @@
-require 'etc'
# group_members($group)
# -> return a array with the login of the group members
module Puppet::Parser::Functions
newfunction(:group_members, :type => :rvalue) do |args|
group = args[0]
- return Etc.getgrnam(group).mem
+ `getent group`.each_line do |l|
+ if l =~ /^#{group}:/ then
+ return l.chomp.split(':')[3].split(',')
+ end
+ end
+ raise ArgumentError, "can't find group for #{group}"
end
end