Skip to content

Commit efa5fc4

Browse files
DPE-7726: Log unit status change to notice Primary label loose
It is hard (impossible?) to catch the Juju Primary label manipulations from Juju debug-log. Logging it simplifyies troubleshooting.
1 parent 9a7a6c2 commit efa5fc4

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/charm.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2090,11 +2090,9 @@ def _set_primary_status_message(self) -> None:
20902090
danger_state = " (read-only)"
20912091
elif len(self._patroni.get_running_cluster_members()) < self.app.planned_units():
20922092
danger_state = " (degraded)"
2093-
self.set_unit_status(
2094-
ActiveStatus(
2095-
f"{'Standby' if self.is_standby_leader else 'Primary'}{danger_state}"
2096-
)
2097-
)
2093+
unit_status = "Standby" if self.is_standby_leader else "Primary"
2094+
unit_status = unit_status + danger_state
2095+
self.set_unit_status(ActiveStatus(f"{unit_status}"))
20982096
elif self._patroni.member_started:
20992097
self.set_unit_status(ActiveStatus())
21002098
except (RetryError, ConnectionError) as e:

0 commit comments

Comments
 (0)