Hello Chefs!
I¹ve come across an interesting issue with Chef 11.12.8 on Ubuntu 12.04.
I¹ve got a chef-client bootstrap that includes the chef-client cookbook,
managing chef-client as an init service (upstart seems to work fine).
It seems that chef-client as a daemon holds a lock, but exits gracefully,
thus resulting in chef-client not running at all on the system post chef
run.
Scenario:
- Vanilla Ubuntu 12.04 install with Chef 11.12.8 debian package installed.
Note that init scripts are not installed to /etc/init.d or /etc/init - Chef client #1 manually started with run-list including
"recipe[chef-client]" - Chef-client recipe starts chef-client as a service (client #2)
- Client #2 waits for Client #1 to finish
- Client #1 updates /etc/init.d/chef-client template, which triggers
chef-client service restart - Client #2 receives SIGTERM, which waits complete recipe run to shutdown
gracefully - Chef-client #3 starts, and immediately exits, due to Client #2 already
running - Finally Client #1 finishes run, and Client #2 starts its run
- Client #2 ensures that service is running, which is correct (i.e. Client
#2 is running) - Client #2 finishes run, and gracefully stops
Result:
- No chef-clients running. Client #1 was a one-time run, Client #2 asked
to shutdown gracefully, and Client #3 terminated since Client #2 already
running.
Note that changing DIETIME and SLEEPTIME does not change the results, as
Client #1 waits for the init scripts to complete.
I¹ve filed https://github.com/opscode-cookbooks/chef-client/issues/173
against the chef-client cookbook, but in the meantime I¹ve switched to
upstart as the init_style. Other than using upstart, is there a
recommended way to start chef-client as a daemon, from a knife bootstrap?
Thanks!
Andrew