From cc96d33bea494ac4ddc7ebb327a356c57b93533a Mon Sep 17 00:00:00 2001 From: Neha Oudin Date: Mon, 23 Sep 2024 17:31:13 +0200 Subject: [PATCH] fix: need to be leader --- lib/charms/mongodb/v0/config_server_interface.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/charms/mongodb/v0/config_server_interface.py b/lib/charms/mongodb/v0/config_server_interface.py index 03be994c..44f5b26b 100644 --- a/lib/charms/mongodb/v0/config_server_interface.py +++ b/lib/charms/mongodb/v0/config_server_interface.py @@ -318,7 +318,8 @@ def _on_relation_changed(self, event) -> None: return self.charm.status.set_and_share_status(ActiveStatus()) - self.charm.mongos_initialised = True + if self.charm.unit.is_leader(): + self.charm.mongos_initialised = True def _on_relation_broken(self, event: RelationBrokenEvent) -> None: # Only relation_deparated events can check if scaling down