canonical / pebble

Take control of your internal daemons!
https://canonical-pebble.readthedocs-hosted.com/
GNU General Public License v3.0
143 stars 54 forks source link

feat: make shutdown action return meaningful exit code #336

Closed benhoyt closed 9 months ago

benhoyt commented 9 months ago

This PR makes Pebble shutdowns due to on-failure: shutdown return exit code 10 instead of always returning exit code 0. The code 10 was chosen to keep it "a few away" from other Pebble exit codes.

Similarly, if on-check-failure is used with shutdown, return exit code 11 instead of always returning code 0. (The 11 to distinguish a "check failure" shutdown from a "service failure" shutdown.

It also adds support for on-failure: success-shutdown (also for on-check-failure) and on-success: failure-shutdown, which reverses the "polarity" of the exit code for those cases.

Both of these are as per spec DA062.

Fixes #324.