Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rolling restart by adding a dedicated callback method #177

Merged
merged 2 commits into from
Jan 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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():
Expand Down
Loading