What are the best practices for stop hook handling?
rye.terrell at canonical.com
Wed Oct 19 14:16:41 UTC 2016
I have a number of questions regarding how to handle stop hooks properly:
1. Background services - stop them or stop & disable them?
The docs say "stop runs immediately before the end of the unit's
destruction sequence. It should be used to ensure that the charm's software
is not running, and will not start again on reboot."
Can anyone verify that that is correct? If so, it seems clear that services
should be stopped & disabled, but leaves me with another question - is
there no hook that handles scenarios like host rebooting?
If it's not correct, what is the proper behavior for the stop hook handler?
Stop & disable on stop hook and start & enable on start hook?
2. Background services - how do we handle colocated applications with
shared background services?
I'm not sure this is something we support, but if so, what do we do when
one application is stopped and it has a colocated application that shares a
background service dependency? I don't think this is something we can
detect at the charm level, so do we _not_ stop services so that we don't
3. File cleanup - is anyone doing this?
The docs also say "Remove any files/configuration created during the
service lifecycle" is part of a charm's stop hook handling behavior. My
experience isn't exactly vast, but I'm unaware of charms doing this. Is
this something we actually do? Should we keep that statement in the docs?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Juju