From b90347504b8272a86e3566d2a9787ee3d6df59e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= Date: Sun, 22 Sep 2024 10:42:18 +0200 Subject: [PATCH] Fixed prepare service variable access The variable cloud_register_certs_path can be accessed uninitialized. This patch makes sure it is only accessed when suse_cloud_regionsrv_setup exists --- suse_migration_services/units/prepare.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/suse_migration_services/units/prepare.py b/suse_migration_services/units/prepare.py index 606aab7..908f2b9 100644 --- a/suse_migration_services/units/prepare.py +++ b/suse_migration_services/units/prepare.py @@ -69,8 +69,9 @@ def main(): ] cache_cloudregister_path = '/var/cache/cloudregister' cloud_register_certs_path_fallback = '/usr/lib/regionService/certs' + cloud_register_certs_bind_mount_path = '' - cloud_register_metadata = "" + cloud_register_metadata = '' if os.path.exists(suse_connect_setup): shutil.copy( @@ -88,6 +89,8 @@ def main(): suse_cloud_regionsrv_setup, cloud_register_certs_path_fallback ) + cloud_register_certs_bind_mount_path = \ + root_path + cloud_register_certs_path report_if_regionsrv_certs_not_found( root_path + cloud_register_certs_path, log ) @@ -202,8 +205,6 @@ def main(): cache_cloudregister_path ] ) - cloud_register_certs_bind_mount_path = \ - root_path + cloud_register_certs_path if os.path.exists(cloud_register_certs_bind_mount_path): log.info( 'Bind mounting {0} from {1}'.format( @@ -232,6 +233,12 @@ def main(): ) # Check if system is registered migration_config = MigrationConfig() + migration_config.update_migration_config_file() + log.info( + 'Config file content:\n{content}\n'. format( + content=migration_config.get_migration_config_file_content() + ) + ) if migration_config.is_zypper_migration_plugin_requested(): if not SUSEConnect.is_registered(): message = 'System not registered. Aborting migration.'