diff options
author | Mikhail Zholobov <legal90@gmail.com> | 2015-04-05 19:46:06 +0300 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-10-23 12:39:00 -0700 |
commit | d246a05fe763e34c0b9fac698d88a45f4daa1a94 (patch) | |
tree | 90f34da0388a23e177a7634f5fd5d5e45ecc3d10 /lib/chef/provider | |
parent | 60ce05c7af318488655344d134e4fb270f61d888 (diff) | |
download | chef-d246a05fe763e34c0b9fac698d88a45f4daa1a94.tar.gz |
provider/user/dscl: Set default gid to 20
gid should always be defined to create user account properly on OS X.
"staff" (gid 20) is a default group for regular user accounts.
Diffstat (limited to 'lib/chef/provider')
-rw-r--r-- | lib/chef/provider/user/dscl.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb index 0c0c85e18b..d9e235d4b1 100644 --- a/lib/chef/provider/user/dscl.rb +++ b/lib/chef/provider/user/dscl.rb @@ -257,10 +257,13 @@ user password using shadow hash.") # # Sets the group id for the user using dscl. Fails if a group doesn't - # exist on the system with given group id. + # exist on the system with given group id. If `gid` is not specified, it + # sets a default Mac user group "staff", with id 20. # def dscl_set_gid - unless @new_resource.gid && @new_resource.gid.to_s.match(/^\d+$/) + if @new_resource.gid.nil? + @new_resource.gid(20) + elsif !@new_resource.gid.to_s.match(/^\d+$/) begin possible_gid = run_dscl("read /Groups/#{@new_resource.gid} PrimaryGroupID").split(" ").last rescue Chef::Exceptions::DsclCommandFailed => e |