diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-07-20 12:56:15 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-07-20 12:56:15 -0700 |
commit | cdd4db7607792640a709c38aebf16d750618b4df (patch) | |
tree | 0b298a557b88b8e18b4fa0ef27e8a5a3d3303133 /lib/chef/resource/macos_userdefaults.rb | |
parent | c220880c0b81ee13bb02aa0a14ee09ed59076022 (diff) | |
download | chef-cdd4db7607792640a709c38aebf16d750618b4df.tar.gz |
Avoid failures if the host was named "current" and add some more tests
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/resource/macos_userdefaults.rb')
-rw-r--r-- | lib/chef/resource/macos_userdefaults.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/chef/resource/macos_userdefaults.rb b/lib/chef/resource/macos_userdefaults.rb index e43a259135..ea9f5901ba 100644 --- a/lib/chef/resource/macos_userdefaults.rb +++ b/lib/chef/resource/macos_userdefaults.rb @@ -78,8 +78,8 @@ class Chef required: true, desired_state: false - property :host, String, - description: "Set either 'current' or a hostname to set the user default at the host level.", + property :host, [String, Symbol], + description: "Set either :current or a hostname to set the user default at the host level.", desired_state: false, introduced: "16.3" @@ -169,12 +169,13 @@ class Chef action_class do def defaults_modify_cmd - cmd = ["defaults"] + puts "The current action is #{action}" + cmd = ["/usr/bin/defaults"] - if new_resource.host == "current" - state_cmd.concat(["-currentHost"]) + if new_resource.host == :current + cmd.concat(["-currentHost"]) elsif new_resource.host # they specified a non-nil value, which is a hostname - state_cmd.concat(["-host", new_resource.host]) + cmd.concat(["-host", new_resource.host]) end cmd.concat([action.to_s, new_resource.domain, new_resource.key]) |