From 2580de1a5db476b01093a269056d2f5bd0cc3d75 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 22 Mar 2021 18:40:25 -0400 Subject: [PATCH] mgr/cephadm/upgrade: do not crash if error races with user cancellation If the user cancels the upgrade just before the upgrade thread runs into a problem (and these things may be correlated!), ignore the failure instead of crashing the module. Signed-off-by: Sage Weil --- src/pybind/mgr/cephadm/upgrade.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/cephadm/upgrade.py b/src/pybind/mgr/cephadm/upgrade.py index 820b05396248a..0d3066b4151ee 100644 --- a/src/pybind/mgr/cephadm/upgrade.py +++ b/src/pybind/mgr/cephadm/upgrade.py @@ -274,11 +274,13 @@ class CephadmUpgrade: def _fail_upgrade(self, alert_id: str, alert: dict) -> None: assert alert_id in self.UPGRADE_ERRORS - logger.error('Upgrade: Paused due to %s: %s' % (alert_id, - alert['summary'])) if not self.upgrade_state: - assert False, 'No upgrade in progress' + # this could happen if the user canceled the upgrade while we + # were doing something + return + logger.error('Upgrade: Paused due to %s: %s' % (alert_id, + alert['summary'])) self.upgrade_state.error = alert_id + ': ' + alert['summary'] self.upgrade_state.paused = True self._save_upgrade_state() -- 2.39.5