Skip to content

Commit

Permalink
Fix upgrade bug (#144)
Browse files Browse the repository at this point in the history
`force` was `None` if `action_event` was `None` so `force is False`
evaluated to `False` when it should have evaluated to `True`
  • Loading branch information
carlcsaposs-canonical authored Oct 19, 2023
1 parent 85f5cfd commit 5fe721b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def reconcile_partition(self, *, action_event: ops.ActionEvent = None) -> None:
- confirm first upgraded unit is healthy and resume upgrade
- force upgrade of next unit if 1 or more upgraded units are unhealthy
"""
force = action_event and action_event.params.get("force") is True
force = bool(action_event and action_event.params.get("force") is True)

units = self._sorted_units

Expand All @@ -226,7 +226,7 @@ def determine_partition() -> int:
for upgrade_order_index, unit in enumerate(units):
# Note: upgrade_order_index != unit number
if (
force is False and self._peer_relation.data[unit].get("state") != "healthy"
not force and self._peer_relation.data[unit].get("state") != "healthy"
) or self._unit_workload_versions[unit.name] != self._app_workload_version:
if not action_event and upgrade_order_index == 1:
# User confirmation needed to resume upgrade (i.e. upgrade second unit)
Expand Down

0 comments on commit 5fe721b

Please sign in to comment.