Comment 2 for bug 1990140

Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote : Re: [Bug 1990140] Re: Cannot use juju-reboot as a part of a `juju run` invocation

Agreed, it does seem like there are scenarios where an action could
have pre-reboot and post-reboot logic.

This LP wasn't created in relation to the series upgrade use-case,
however, it does remind me of the pre-series-upgrade and
post-series-upgrade workflow for which there are two separate events.

https://juju.is/docs/olm/manage-machines#heading--upgrade-the-ubuntu-series-of-a-machine
https://juju.is/docs/sdk/pre-series-upgrade-event
https://juju.is/docs/sdk/post-series-upgrade-event

From the operations point of view, there are trade-offs as to whether
to treat what happens before a reboot and after a reboot as a single
event or not (or a single action). We could have charm authors
implement two kinds of events for pre- and post- processing
(potentially extending the framework to provide default handler names
for that too) or provide them with some indicator on whether a reboot
happened since the last invocation of an action or not so that they
can make the necessary multiplexing.

I'm wondering how complicated would it be for Juju to have a slightly
different hook context for the post-reboot event to allow for
multiplexing in the framework (e.g. storing a sequence number to
account for one or multiple reboots) and treat an action as completed
successfully so long as both the pre-reboot and all post-reboot
executions succeed.

On Wed, Nov 16, 2022 at 7:57 PM John A Meinel
<email address hidden> wrote:
>
> I don't have a problem with juju-reboot being available from an action
> context. We'd have to think about when does the "action" complete? Is it
> completed and then a reboot triggers, or is the action still pending during
> the reboot. What is the entry point when you come back in? If you just
> unpowered the machine during an action, I believe we would come back up
> trying to run that action again, but you certainly don't want to have an
> endless loop of juju-reboot firing, causing the action to restart, causing
> juju-reboot to trigger, etc.
>