summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-07-20 11:52:37 -0700
committerTim Smith <tsmith84@gmail.com>2020-07-20 11:52:37 -0700
commitc92270892a6c98bff15302253d683ab619c17f98 (patch)
treed21e17e5c00b9d390b1984304c12041bb2f1b4d7
parentc6a5e780c4ae76e7c6989e7cd4f9d37c055776e6 (diff)
downloadchef-c92270892a6c98bff15302253d683ab619c17f98.tar.gz
Avoid passing around the action we're in
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/macos_userdefaults.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/chef/resource/macos_userdefaults.rb b/lib/chef/resource/macos_userdefaults.rb
index abf99c147f..7cb9a8cbce 100644
--- a/lib/chef/resource/macos_userdefaults.rb
+++ b/lib/chef/resource/macos_userdefaults.rb
@@ -34,7 +34,7 @@ class Chef
**Specify a global domain value**
```ruby
- macos_userdefaults 'full keyboard access to all controls' do
+ macos_userdefaults 'Full keyboard access to all controls' do
key 'AppleKeyboardUIMode'
value '2'
end
@@ -43,7 +43,7 @@ class Chef
**Use an integer value**
```ruby
- macos_userdefaults 'enable macOS firewall' do
+ macos_userdefaults 'Anable macOS firewall' do
domain '/Library/Preferences/com.apple.alf'
key 'globalstate'
value '1'
@@ -54,7 +54,7 @@ class Chef
**Use a boolean value**
```ruby
- macos_userdefaults 'finder expanded save dialogs' do
+ macos_userdefaults 'Finder expanded save dialogs' do
key 'NSNavPanelExpandedStateForSaveMode'
value 'TRUE'
type 'bool'
@@ -139,7 +139,7 @@ class Chef
description "Write the value to the specified domain/key."
converge_if_changed do
- cmd = defaults_modify_cmd("write")
+ cmd = defaults_modify_cmd
Chef::Log.debug("Updating defaults value by shelling out: #{cmd.join(" ")}")
if new_resource.user.nil?
@@ -157,7 +157,7 @@ class Chef
converge_by("delete domain:#{new_resource.domain} key:#{new_resource.key}") do
- cmd = defaults_modify_cmd("delete")
+ cmd = defaults_modify_cmd
Chef::Log.debug("Removing defaults key by shelling out: #{cmd.join(" ")}")
if new_resource.user.nil?
@@ -169,7 +169,7 @@ class Chef
end
action_class do
- def defaults_modify_cmd(defaults_action)
+ def defaults_modify_cmd
cmd = ["defaults"]
if new_resource.host == "current"
@@ -178,8 +178,8 @@ class Chef
state_cmd.concat(["-host", new_resource.host])
end
- cmd.concat([defaults_action, new_resource.domain, new_resource.key])
- cmd.concat(processed_value) if defaults_action == "write"
+ cmd.concat([action.to_s, new_resource.domain, new_resource.key])
+ cmd.concat(processed_value) if action == :write
cmd.prepend("sudo") if new_resource.sudo
cmd
end