summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Chilcote <chilcote+github@gmail.com>2020-01-25 16:36:23 -0800
committerJoseph Chilcote <chilcote+github@gmail.com>2020-01-25 16:36:23 -0800
commit9f3b604b1c205915474b31db58230d7712f96470 (patch)
treef53e10be305b91f8e22163341d5c1146e3a634ef
parentfc7626547569a368ae3d53e3917467e8b04f3555 (diff)
downloadchef-9f3b604b1c205915474b31db58230d7712f96470.tar.gz
Account for if the propery is not being set in the resource, and also if it doesn't exist in the user record
Signed-off-by: Joseph Chilcote <chilcote@fb.com>
-rw-r--r--lib/chef/provider/user/mac.rb5
-rw-r--r--lib/chef/resource/user/mac_user.rb2
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/chef/provider/user/mac.rb b/lib/chef/provider/user/mac.rb
index a8c97ef040..c570399ca3 100644
--- a/lib/chef/provider/user/mac.rb
+++ b/lib/chef/provider/user/mac.rb
@@ -51,7 +51,10 @@ class Chef
current_resource.home(user_plist[:home][0])
current_resource.shell(user_plist[:shell][0])
current_resource.comment(user_plist[:comment][0])
- current_resource.hidden(user_plist[:is_hidden][0] == "1" ? true : false)
+
+ if user_plist[:is_hidden]
+ current_resource.hidden(user_plist[:is_hidden][0] == "1" ? true : false)
+ end
shadow_hash = user_plist[:shadow_hash]
if shadow_hash
diff --git a/lib/chef/resource/user/mac_user.rb b/lib/chef/resource/user/mac_user.rb
index 4b9c12bc64..2d53e1310e 100644
--- a/lib/chef/resource/user/mac_user.rb
+++ b/lib/chef/resource/user/mac_user.rb
@@ -101,7 +101,7 @@ class Chef
property :admin, [TrueClass, FalseClass], description: "Create the user as an admin", default: false
# Hide a user account in the macOS login window
- property :hidden, [TrueClass, FalseClass], description: "Hide account from loginwindow and system preferences", default: false
+ property :hidden, [TrueClass, FalseClass, nil], description: "Hide account from loginwindow and system preferences", default: nil
# TCC on macOS >= 10.14 requires admin credentials of an Admin user that
# has SecureToken enabled in order to toggle SecureToken.