upgrades: Check apt result during dist-upgrade

In case apt full-upgrade fails for any reason, do not
continue. Otherwise, may get stuck unattended-upgrade later (#2266).

Since the dist-upgrade flag remains set, Plinth should retry the
dist-upgrade later.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2023-04-10 10:36:27 -04:00
parent e25468c07d
commit c64e6e7723
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -518,7 +518,13 @@ def _perform_dist_upgrade():
', '.join(DIST_UPGRADE_PACKAGES_WITH_PROMPTS) + '...', flush=True)
with apt_hold(DIST_UPGRADE_PACKAGES_WITH_PROMPTS):
print('Running apt full-upgrade...', flush=True)
run_apt_command(['full-upgrade'])
returncode = run_apt_command(['full-upgrade'])
# Check if apt upgrade was successful.
if returncode:
raise RuntimeError(
'Apt full-upgrade was not successful. Distribution upgrade '
'will be retried at a later time.')
_update_searx(reenable_searx)