Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to understand the hooks for a juju charm, some of them are rather obvious and easy to understand (start, stop, install,etc), others not really.

How many hooks are there, when are they called, for what function?

I am looking for a good list of hooks and their descriptions.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

The documentation for all available hooks is scattered a bit by topic in the documentation.

The basic lifecycle (install, start, stop) and relation hooks are documented under charms. Relation hooks are defined for every relation a charm defines in its metadata.

https://juju.ubuntu.com/docs/charm.html#hooks

Beyond those there are two other hooks of interest, the 'upgrade-charm' hook, which is called when a service's charm is upgraded for each of its service units.

https://juju.ubuntu.com/docs/charm-upgrades.html#charm-upgrade-support

The other is the 'config-changed' hook, called when a charm which defines a service configuration schema has its configuration changed, since services can be deployed with configuration data, the config-changed hook is also invoked upon the initial deploy of a unit prior to starting it.

https://juju.ubuntu.com/docs/drafts/service-config.html#creating-charms

all hooks are optional.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.