Created
October 21, 2011 09:12
-
-
Save juanje/1303414 to your computer and use it in GitHub Desktop.
Chef ohai plugin for home users
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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