From 0fb2ff2922181a661301641061a42f73c23a4663 Mon Sep 17 00:00:00 2001 From: Niels Robin-Aubertin Date: Wed, 17 Jan 2024 10:51:53 -0500 Subject: [PATCH] Add handler method for rolling restart --- src/charm.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/charm.py b/src/charm.py index f0f22233..ccc908fc 100755 --- a/src/charm.py +++ b/src/charm.py @@ -123,7 +123,7 @@ def __init__(self, *args): self._grafana_dashboards = GrafanaDashboardProvider(self) self.restart_manager = RollingOpsManager( - charm=self, relation="restart", callback=self._setup_and_activate + charm=self, relation="restart", callback=self._on_rolling_restart ) def _on_start(self, _: ops.StartEvent) -> None: @@ -193,6 +193,14 @@ def _on_config_changed(self, _: HookEvent) -> None: """ self._configure_pod() + def _on_rolling_restart(self, _: ops.EventBase) -> None: + """Handle rolling restart event. + + Args: + event: Event triggering the discourse rolling restart event handler. + """ + self._setup_and_activate() + def _setup_and_activate(self) -> None: """Set up discourse, configure the pod and eventually activate the charm.""" if not self._is_setup_completed():