Event > List of events > Lifecycle events >
install
Source:
ops.InstallEvent
This document describes the install
event.
Contents:
Emission sequence
The install
event is emitted once per unit at the beginning of a charm’s lifecycle. Associated callbacks should be used to perform one-time initial setup operations and prepare the unit to execute the application. Depending on the charm, this may include installing packages, configuring the underlying machine or provisioning cloud-specific resources.
Therefore, ways to cause install
to occur are:
Scenario | Example Command | Resulting Events |
---|---|---|
Create unit |
juju deploy foo juju add-unit foo
|
install -> config-changed |
Note:
- Typically, operations performed on
install
should also be considered forupgrade-charm
.- In some cases,
config-changed
can be used instead ofinstall
andupgrade-charm
because it is guaranteed to fire after both.
Observing this event in Ops
In ops
, you can observe this event like you would any other:
# in MyCharm.__init__
self.framework.observe(self.on.install, self._on_install)
The install
event object does not expose any specific attributes.