Skip to content

Instantly share code, notes, and snippets.

@juanje
Created October 21, 2011 09:12
Show Gist options
  • Save juanje/1303414 to your computer and use it in GitHub Desktop.
Save juanje/1303414 to your computer and use it in GitHub Desktop.
Chef ohai plugin for home users
provides 'home_users'
require 'etc'
home_users Mash.new
etcpasswd = []
Etc.passwd do |entry|
etcpasswd << entry
end
Dir["/home/*"].each do |homedir|
etcpasswd.each do |entry|
if homedir == entry.dir
home_users[homedir] = Mash.new(
:username => entry.name,
:gid => entry.gid,
:uid => entry.uid,
:gecos => entry.gecos
)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment