From d246a05fe763e34c0b9fac698d88a45f4daa1a94 Mon Sep 17 00:00:00 2001 From: Mikhail Zholobov Date: Sun, 5 Apr 2015 19:46:06 +0300 Subject: 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. --- lib/chef/provider/user/dscl.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/chef/provider/user') 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 -- cgit v1.2.1