From dc0b4682b91cd80fc0fd85cef693be25a16739c6 Mon Sep 17 00:00:00 2001 From: Lucas Gameiro Borges Date: Wed, 29 May 2024 17:32:44 +0000 Subject: [PATCH] fix relation_departed condition --- src/relations/async_replication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/relations/async_replication.py b/src/relations/async_replication.py index 39543480fa..320beeb487 100644 --- a/src/relations/async_replication.py +++ b/src/relations/async_replication.py @@ -487,7 +487,7 @@ def _on_async_relation_changed(self, event: RelationChangedEvent) -> None: def _on_async_relation_departed(self, event: RelationDepartedEvent) -> None: """Set a flag to avoid setting a wrong status message on relation broken event handler.""" # This is needed because of https://bugs.launchpad.net/juju/+bug/1979811. - if event.departing_unit == self.charm.unit or self.charm._peers is None: + if event.departing_unit == self.charm.unit and self.charm._peers is not None: self.charm._peers.data[self.charm.unit].update({"departing": "True"}) def _on_async_relation_joined(self, _) -> None: