summaryrefslogtreecommitdiff
path: root/lib/chef/provider
diff options
context:
space:
mode:
authorMikhail Zholobov <legal90@gmail.com>2015-04-05 20:01:41 +0300
committerLamont Granquist <lamont@scriptkiddie.org>2015-10-24 12:01:11 -0700
commitb59d53b868d45908929839b0eed5c25cb392ae49 (patch)
tree27a78db439700f4187d9edd2e5128c97c7c224ef /lib/chef/provider
parent8bf1304da739d4be94edb101ad9e46c96b1d4ccd (diff)
downloadchef-b59d53b868d45908929839b0eed5c25cb392ae49.tar.gz
provider/user/dscl: Set "comment" default value
"comment" attribute should be defined to create user account properly on OS X. Otherwise, the RealName will be empty.
Diffstat (limited to 'lib/chef/provider')
-rw-r--r--lib/chef/provider/user/dscl.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb
index d9e235d4b1..a2c76ca6d7 100644
--- a/lib/chef/provider/user/dscl.rb
+++ b/lib/chef/provider/user/dscl.rb
@@ -195,9 +195,10 @@ user password using shadow hash.")
#
# Saves the specified Chef user `comment` into RealName attribute
- # of Mac user.
+ # of Mac user. If `comment` is not specified, it takes `username` value.
#
def dscl_create_comment
+ @new_resource.comment(@new_resource.username) if @new_resource.comment.nil?
run_dscl("create /Users/#{@new_resource.username} RealName '#{@new_resource.comment}'")
end