From e8605283e4b4ee71fee72cc1fd7eac26dd329521 Mon Sep 17 00:00:00 2001 From: James Page Date: Thu, 6 Oct 2022 16:24:58 +0100 Subject: [PATCH] Misc fixes Only run DB syncs on lead unit. Ensure current event is passed to configure_charm method. Change-Id: Ic706b866af365fde36cf4a665a2c26e952aedbe0 --- ops-sunbeam/ops_sunbeam/charm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ops-sunbeam/ops_sunbeam/charm.py b/ops-sunbeam/ops_sunbeam/charm.py index c868280a..cb880ea9 100644 --- a/ops-sunbeam/ops_sunbeam/charm.py +++ b/ops-sunbeam/ops_sunbeam/charm.py @@ -316,7 +316,7 @@ class OSBaseOperatorCharm(ops.charm.CharmBase): } def _on_config_changed(self, event: ops.framework.EventBase) -> None: - self.configure_charm(None) + self.configure_charm(event) def containers_ready(self) -> bool: """Determine whether all containers are ready for configuration.""" @@ -389,6 +389,9 @@ class OSBaseOperatorCharm(ops.charm.CharmBase): :raises: pebble.ExecError """ + if not self.unit.is_leader(): + logging.info('Not lead unit, skipping DB syncs') + return try: if self.db_sync_cmds: logger.info("Syncing database...")