Skip to content

Commit 5fe721b

Browse files
Fix upgrade bug (#144)
`force` was `None` if `action_event` was `None` so `force is False` evaluated to `False` when it should have evaluated to `True`
1 parent 85f5cfd commit 5fe721b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/upgrade.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def reconcile_partition(self, *, action_event: ops.ActionEvent = None) -> None:
215215
- confirm first upgraded unit is healthy and resume upgrade
216216
- force upgrade of next unit if 1 or more upgraded units are unhealthy
217217
"""
218-
force = action_event and action_event.params.get("force") is True
218+
force = bool(action_event and action_event.params.get("force") is True)
219219

220220
units = self._sorted_units
221221

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

0 commit comments

Comments
 (0)