Why are group members always empty?

asked 2014-11-06 17:35:26 -0600

l0b0 gravatar image

I've used existing code to create a custom fact group_users_members which should contain the members of the users group space separated:

#!/usr/bin/env ruby    
require 'etc'

Etc.group do |group|
  Facter.add("group_#{group.name}_members".intern) do
    setcode do
      group.mem.join(' ')
    end
  end
end

In my template I have the following:

<% if @group_users_members %>Users <% @group_users_members %><% end %>

The string Users followed by a space is printed, but there are never any group members even though I am a member:

$ groups
wheel users

$ uname --kernel-name --kernel-release --kernel-version --machine --processor --hardware-platform --operating-system
Linux 3.17.2-1-ARCH #1 SMP PREEMPT Thu Oct 30 20:49:39 CET 2014 x86_64 unknown unknown GNU/Linux
edit retag flag offensive close merge delete