summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Chilcote <chilcote+github@gmail.com>2020-01-25 16:36:23 -0800
committerTim Smith <tsmith84@gmail.com>2020-02-03 13:09:06 -0800
commit8138e29824322b1381fb241946e46371c0725fde (patch)
treef6a3627b61dcc418eb70c57eac69a770564db69f
parent50ac882b9ed00b07e1f67bc5b1bc2a1c9630c850 (diff)
downloadchef-8138e29824322b1381fb241946e46371c0725fde.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.