Skip to content

Commit 82061ba

Browse files
committed
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
1 parent 287f7c9 commit 82061ba

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

suse_migration_services/prechecks/cpu_arch.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ def x86_64_version():
4545
)
4646

4747

48-
def cpu_arch():
48+
def cpu_arch(migration_system=False):
4949
"""Function for CPU architecture related checks"""
50+
if migration_system:
51+
# This check must not be called inside of the
52+
# migration system live iso or container image.
53+
# It will only be useful on the system to migrate
54+
# at install time of the Migration package or on
55+
# manual user invocation of suse-migration-pre-checks
56+
# prior the actual migration.
57+
return
58+
5059
x86_64_version()

suse_migration_services/prechecks/pre_checks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def main():
9292
log.info('Checking harmful migration conditions')
9393

9494
log.info('--> Checking system architecture version...')
95-
check_cpu_arch.cpu_arch()
95+
check_cpu_arch.cpu_arch(migration_system=migration_system_mode)
9696

9797
log.info('--> Checking for local private repos...')
9898
check_repos.remote_repos(migration_system=migration_system_mode)
@@ -117,7 +117,7 @@ def main():
117117
log.info('Done')
118118

119119
log.info('--> Checking high availability extension...')
120-
check_ha.check_ha()
120+
check_ha.check_ha(migration_system=migration_system_mode)
121121
log.info('Done')
122122

123123
log.info('--> Checking wicked to NetworkManager migration...')

suse_migration_services/units/prepare.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ def perform(self):
100100
try:
101101
shutil.copy(cert_file, trust_anchor)
102102
except FileNotFoundError as issue:
103-
self.log.warning('Import of {} failed with {}'.format(cert_file, issue))
103+
self.log.warning(
104+
'Import of {} failed with {}'.format(cert_file, issue)
105+
)
104106
self.log.info('Update certificate pool')
105107
Command.run(['update-ca-certificates'])
106108

test/unit/pre_checks_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,10 @@ def test_check_x86_64_v2(
948948
assert 'SLE16 requires x86_64_v2 at minimum' not in self._caplog.text
949949
mock_Command_run.assert_called_once_with(['zypper', 'system-architecture'])
950950

951+
mock_Command_run.reset_mock()
952+
check_cpu_arch.cpu_arch(True)
953+
mock_Command_run.assert_not_called()
954+
951955
@patch('suse_migration_services.command.Command.run')
952956
@patch('suse_migration_services.migration_target.MigrationTarget.get_migration_target')
953957
def test_check_x86_64_v1(

0 commit comments

Comments
 (0)