summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-09-04 18:38:23 -0700
committerTim Smith <tsmith84@gmail.com>2020-09-05 20:15:00 -0700
commit1fb9d0963983aea7e3a9392de5a49e1139af4f03 (patch)
tree37a907a78d341d671240d3b5ab0c3e9ade03f265
parent54d23a6ace8dd2e915104ede6926bef0fe00a6cd (diff)
downloadchef-1fb9d0963983aea7e3a9392de5a49e1139af4f03.tar.gz
Improve comments on the restarter
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/chef_client_launchd.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/chef/resource/chef_client_launchd.rb b/lib/chef/resource/chef_client_launchd.rb
index 41f50dd1ad..75c6912743 100644
--- a/lib/chef/resource/chef_client_launchd.rb
+++ b/lib/chef/resource/chef_client_launchd.rb
@@ -122,6 +122,11 @@ class Chef
action :enable
end
+ # Launchd doesn't have the concept of a reload aka restart. Instead to update a daemon config you have
+ # to unload it and then reload the new plist. That's usually fine, but not if chef-client is trying
+ # to restart itself. If the chef-client process uses launchd or macosx_service resources to restart itself
+ # we'll end up with a stopped service that will never get started back up. Instead we use this daemon
+ # that triggers when the chef-client plist file is updated, and handles the restart outside the run.
launchd "com.#{Chef::Dist::SHORT}.restarter" do
username "root"
watch_paths ["/Library/LaunchDaemons/com.#{Chef::Dist::SHORT}.#{Chef::Dist::CLIENT}.plist"]