diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-07-06 21:02:58 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-07-20 11:45:27 -0700 |
commit | 2053b5524c58f88afe7e8f69d7d1257e9870a11e (patch) | |
tree | b9fa502de3a3d23f060013b13f1595776c2e7a57 /lib/chef/resource/macos_userdefaults.rb | |
parent | 00105449ad8b9a49cdd2705924da28a0c8e4d61a (diff) | |
download | chef-2053b5524c58f88afe7e8f69d7d1257e9870a11e.tar.gz |
Switch to shellout instead of using execute
This improves the log output
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 | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/chef/resource/macos_userdefaults.rb b/lib/chef/resource/macos_userdefaults.rb index 9936dde44f..2e68351184 100644 --- a/lib/chef/resource/macos_userdefaults.rb +++ b/lib/chef/resource/macos_userdefaults.rb @@ -16,7 +16,7 @@ # require_relative "../resource" -require "shellwords" +require_relative "../dist" class Chef class Resource @@ -131,8 +131,13 @@ class Chef converge_if_changed do # FIXME: this should use cmd directly as an array argument, but then the quoting # of individual args above needs to be removed as well. - execute defaults_write_cmd.join(" ") do - user new_resource.user unless new_resource.user.nil? + cmd = defaults_write_cmd + Chef::Log.debug("Updating defaults value by shelling out: #{cmd}") + + if new_resource.user.nil? + shell_out(cmd) + else + shell_out(cmd, user: new_resource.user) end end end |