canonical / pebble

Take control of your internal daemons!
GNU General Public License v3.0
136 stars 51 forks source link

docs: various improvements to "service dependencies" section #442

Closed benhoyt closed 4 days ago

benhoyt commented 1 week ago

on-check-failure is a map of check name to value, so this field doesn't have a default, you have to add keys and values to the map explicitly. I believe this incorrect text was just a copy 'n' paste error.

In addition, I've added a (hopefully-clarifying) paragraph and tweaked things a bit.

Fixes https://github.com/canonical/pebble/issues/439

benhoyt commented 4 days ago

So... it's OK to load config from disc with --on-hold or possibly replan, but an error would be raised later, when trying to start a service?

That's a good question (you had me guessing), but no, it's actually when the plan is loaded (when pebble run starts):

$ cat /var/lib/pebble/default/layers/001-base.yaml 
services:
  nginx:
    override: replace
    command: sleep 3000
    after: [logger]
  logger:
    override: replace
    command: sleep 2000
    after: [nginx]
$ pebble run
cannot run daemon: cannot load plan: services in before/after loop: logger, nginx
# exit code 1

I've fixed this paragraph and clarified in https://github.com/canonical/pebble/pull/442/commits/4036e7aec6d2f4d45fa2e8b336aacaada24da5b5. (Also, requires isn't involved, as a loop there is okay; it's just before/after.)