From 82061baebdd11b40128860e2fa814a37924ed1ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= Date: Wed, 18 Mar 2026 12:42:52 +0100 Subject: [PATCH] Fixed scope check for cpu_arch and check_ha The prechecks for cpu_arch and ha did not receive the value for the migration_system mode. As such these checks could not differentiate between being called on the host to upgrade or as part of the live migration system. This lead to unwanted check calls and invalid fail information as part of the migration log file --- suse_migration_services/prechecks/cpu_arch.py | 11 ++++++++++- suse_migration_services/prechecks/pre_checks.py | 4 ++-- suse_migration_services/units/prepare.py | 4 +++- test/unit/pre_checks_test.py | 4 ++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/suse_migration_services/prechecks/cpu_arch.py b/suse_migration_services/prechecks/cpu_arch.py index 632c6719..e57c7429 100644 --- a/suse_migration_services/prechecks/cpu_arch.py +++ b/suse_migration_services/prechecks/cpu_arch.py @@ -45,6 +45,15 @@ def x86_64_version(): ) -def cpu_arch(): +def cpu_arch(migration_system=False): """Function for CPU architecture related checks""" + if migration_system: + # This check must not be called inside of the + # migration system live iso or container image. + # It will only be useful on the system to migrate + # at install time of the Migration package or on + # manual user invocation of suse-migration-pre-checks + # prior the actual migration. + return + x86_64_version() diff --git a/suse_migration_services/prechecks/pre_checks.py b/suse_migration_services/prechecks/pre_checks.py index a00800e3..fa281c86 100644 --- a/suse_migration_services/prechecks/pre_checks.py +++ b/suse_migration_services/prechecks/pre_checks.py @@ -92,7 +92,7 @@ def main(): log.info('Checking harmful migration conditions') log.info('--> Checking system architecture version...') - check_cpu_arch.cpu_arch() + check_cpu_arch.cpu_arch(migration_system=migration_system_mode) log.info('--> Checking for local private repos...') check_repos.remote_repos(migration_system=migration_system_mode) @@ -117,7 +117,7 @@ def main(): log.info('Done') log.info('--> Checking high availability extension...') - check_ha.check_ha() + check_ha.check_ha(migration_system=migration_system_mode) log.info('Done') log.info('--> Checking wicked to NetworkManager migration...') diff --git a/suse_migration_services/units/prepare.py b/suse_migration_services/units/prepare.py index d7c20fdb..1e71c5be 100644 --- a/suse_migration_services/units/prepare.py +++ b/suse_migration_services/units/prepare.py @@ -100,7 +100,9 @@ def perform(self): try: shutil.copy(cert_file, trust_anchor) except FileNotFoundError as issue: - self.log.warning('Import of {} failed with {}'.format(cert_file, issue)) + self.log.warning( + 'Import of {} failed with {}'.format(cert_file, issue) + ) self.log.info('Update certificate pool') Command.run(['update-ca-certificates']) diff --git a/test/unit/pre_checks_test.py b/test/unit/pre_checks_test.py index 5cddf637..534b976e 100644 --- a/test/unit/pre_checks_test.py +++ b/test/unit/pre_checks_test.py @@ -948,6 +948,10 @@ def test_check_x86_64_v2( assert 'SLE16 requires x86_64_v2 at minimum' not in self._caplog.text mock_Command_run.assert_called_once_with(['zypper', 'system-architecture']) + mock_Command_run.reset_mock() + check_cpu_arch.cpu_arch(True) + mock_Command_run.assert_not_called() + @patch('suse_migration_services.command.Command.run') @patch('suse_migration_services.migration_target.MigrationTarget.get_migration_target') def test_check_x86_64_v1(