Hook
A hook is an event handler.
In Juju, several frameworks have been used to facilitate charming. Depending on the framework being used, a ‘hook’ can be implemented in different ways:
- In the hooks-based framework, they were executable files placed in the
/hooks
folder of a charm. - In the reactive-framework, they were functions in a single Python file.
- In the current, Ops (
ops
) framework they are code blocks, typically methods of a class that inherits fromCharmBase
and represents the charm object.
The events have not changed across the various frameworks. Only the way of implementing the hooks handling them has changed.
Last updated 8 months ago.