summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-10-23 12:40:59 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2015-10-23 12:40:59 -0700
commit8bf1304da739d4be94edb101ad9e46c96b1d4ccd (patch)
treedd018f50f47fc4f4e56f5d0d10a4e39a97fb17f0 /lib
parent60ce05c7af318488655344d134e4fb270f61d888 (diff)
parente6738afc43956937ac4f890f48115f205933d2cd (diff)
downloadchef-8bf1304da739d4be94edb101ad9e46c96b1d4ccd.tar.gz
Merge pull request #4097 from chef/lcg/3192
provider/user/dscl: Set default gid to 20
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/provider/user/dscl.rb7
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