summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-09-05 20:07:46 -0700
committerTim Smith <tsmith84@gmail.com>2020-09-05 20:15:00 -0700
commite2c0b51603784b6b674e01c6e607209e1d3aaa7a (patch)
tree0c363930674bdee3623c0945b47bf3332505d59b
parent1fb9d0963983aea7e3a9392de5a49e1139af4f03 (diff)
downloadchef-launchd_restart.tar.gz
Minor fixes with a fresh eyelaunchd_restart
Only use launchd create action on the service itself. Enable will trigger restarts which we want to avoid since that will prematurely hang things Make sure we disable the restarter plist as well if someone runs the disable action otherwise any manual plist work will turn the client back on Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/chef_client_launchd.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/chef/resource/chef_client_launchd.rb b/lib/chef/resource/chef_client_launchd.rb
index 75c6912743..03aa012832 100644
--- a/lib/chef/resource/chef_client_launchd.rb
+++ b/lib/chef/resource/chef_client_launchd.rb
@@ -119,7 +119,7 @@ class Chef
nice new_resource.nice
low_priority_io true
notifies :sleep, "chef_sleep[Sleep before client restart]", :immediately
- action :enable
+ action :create # create only creates the file. No service restart triggering
end
# Launchd doesn't have the concept of a reload aka restart. Instead to update a daemon config you have
@@ -135,7 +135,7 @@ class Chef
program_arguments ["/bin/bash",
"-c",
"echo; echo #{Chef::Dist::PRODUCT} launchd daemon config has been updated. Manually unloading and reloading the daemon; echo Now unloading the daemon; launchctl unload /Library/LaunchDaemons/com.#{Chef::Dist::SHORT}.#{Chef::Dist::CLIENT}.plist; sleep 2; echo Now loading the daemon; launchctl load /Library/LaunchDaemons/com.#{Chef::Dist::SHORT}.#{Chef::Dist::CLIENT}.plist"]
- action :enable
+ action :enable # enable creates the plist & triggers service restarts on change
end
# We want to make sure that after we update the chef-client launchd config that we don't move on to another recipe
@@ -149,10 +149,14 @@ class Chef
end
action :disable do
- service "#{Chef::Dist::CLIENT}" do
+ service "#{Chef::Dist::PRODUCT}" do
service_name "com.#{Chef::Dist::SHORT}.#{Chef::Dist::CLIENT}"
action :disable
end
+
+ service "com.#{Chef::Dist::SHORT}.restarter" do
+ action :disable
+ end
end
action_class do