From ab59136cc8f63e18c080787ba5965e452cd13a7f Mon Sep 17 00:00:00 2001 From: Carl Csaposs Date: Fri, 6 Oct 2023 08:34:04 +0000 Subject: [PATCH] Fix bug in lifecycle.py for subordinate charms without other relations _UnitTearingDownAndAppActive was set to UNKNOWN for subordinate charms without non-subordinate relations during relation-broken --- src/lifecycle.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lifecycle.py b/src/lifecycle.py index ca230feb..83f00ef5 100644 --- a/src/lifecycle.py +++ b/src/lifecycle.py @@ -123,6 +123,9 @@ def _on_subordinate_relation_broken(self, event: ops.RelationBrokenEvent) -> Non if "dying" in principal_unit_statuses and principal_unit_statuses != {"dying"}: # Situation #4 self._unit_tearing_down_and_app_active = _UnitTearingDownAndAppActive.TRUE + else: + # Situation #1, #2, or #3 + self._unit_tearing_down_and_app_active = _UnitTearingDownAndAppActive.FALSE @property def authorized_leader(self) -> bool: