Often, Juju charms have helpers that encounter situations that should result in a Juju status (eg: a helper parsing charm config might see an invalid config that should result in BlockedStatus
). Many charm code authors feel it is an antipattern to set charm status from a helper because it makes charms harder to read (from a top level, its hard to tell where in your charm statuses might be set), but in cases where the helper knows status should result of this situation (BlockedStatus("Blocked because X is unset")
) or at least has context to add about the error it is hard to pass this information back to the charm. In particular, when trying to make resuable helpers that are shared across many charms, this can lead to a lot of complex logic and error handling that is implemented in every charm.
Below is a pattern modified/stolen from: