Skip to content

Commit

Permalink
Fix issue if incompatible upgrade forced (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlcsaposs-canonical authored Apr 23, 2024
1 parent f82a3d2 commit 0b46746
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/abstract_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ def reconcile(self, event=None) -> None: # noqa: C901
logger.debug("Peer relation not ready")
return
workload_ = self.get_workload(event=event)
if self._unit_lifecycle.authorized_leader and not self._upgrade.in_progress:
# Run before checking `self._upgrade.is_compatible` in case incompatible upgrade was
# forced & completed on all units.
self._upgrade.set_versions_in_app_databag()
if self._upgrade.unit_state == "restarting": # Kubernetes only
if not self._upgrade.is_compatible:
logger.info(
Expand Down Expand Up @@ -300,8 +304,6 @@ def reconcile(self, event=None) -> None: # noqa: C901
self._upgrade.unit_state = "healthy"
if self._unit_lifecycle.authorized_leader:
self._upgrade.reconcile_partition()
if not self._upgrade.in_progress:
self._upgrade.set_versions_in_app_databag()
self.set_status(event=event)
except server_exceptions.Error as e:
# If not for `unit=False`, another `server_exceptions.Error` could be thrown here
Expand Down

0 comments on commit 0b46746

Please sign in to comment.