setup: Ensure that apt is updated before checking force upgrade

If the package cache is outdated and a check is performed for whether force
upgrade is needed, it might return negative. After the operation proceeds to run
setup, we perform 'apt update' before 'apt install' at this point the
configuration file prompt will cause failure.

Tests:

- Re-run firewalld upgrade from 1.3.x to 2.1.x with a re-run setup.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2024-02-14 16:46:43 -08:00 committed by James Valleroy
parent e208bdbbca
commit bd4ddcf158
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -62,6 +62,7 @@ def _run_setup_on_app(app, current_version):
# Check if this app needs force_upgrade. If it is needed, but not
# yet supported for the new version of the package, then an
# exception will be raised, so that we do not run setup.
package.refresh_package_lists()
force_upgrader = ForceUpgrader.get_instance()
force_upgrader.attempt_upgrade_for_app(app.app_id)