From 9fc630c552d5f4cfa89fb9f84f40c975e1de9168 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Tue, 11 May 2021 18:43:53 +0300 Subject: [PATCH] [sonic_installer] temporary fix: don't migrate packages on aboot platforms (#1607) What I did Skip sonic package migration on aboot platform. How I did it Added a warning and skip the migration. How to verify it I changed AbootBootloader to OnieInstallerBootloader to test on my Onie device. I don't have Aboot device. --- sonic_installer/main.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sonic_installer/main.py b/sonic_installer/main.py index 5f89878344f5..57cd5adda899 100644 --- a/sonic_installer/main.py +++ b/sonic_installer/main.py @@ -12,6 +12,7 @@ from swsscommon.swsscommon import SonicV2Connector from .bootloader import get_bootloader +from .bootloader.aboot import AbootBootloader from .common import ( run_command, run_command_or_raise, IMAGE_PREFIX, @@ -23,7 +24,7 @@ from .exception import SonicRuntimeException SYSLOG_IDENTIFIER = "sonic-installer" -LOG_ERR = logger.Logger.LOG_PRIORITY_ERROR +LOG_ERR = logger.Logger.LOG_PRIORITY_ERROR LOG_NOTICE = logger.Logger.LOG_PRIORITY_NOTICE # Global Config object @@ -140,7 +141,7 @@ def echo_and_log(msg, priority=LOG_NOTICE, fg=None): else: click.secho(msg, fg=fg) log.log(priority, msg, False) - + # Function which validates whether a given URL specifies an existent file # on a reachable remote machine. Will abort the current operation if not @@ -323,7 +324,7 @@ def migrate_sonic_packages(bootloader, binary_image_version): with contextlib.ExitStack() as stack: def get_path(path): - """ Closure to get path by entering + """ Closure to get path by entering a context manager of bootloader.get_path_in_image """ return stack.enter_context(bootloader.get_path_in_image(new_image_dir, path)) @@ -433,6 +434,10 @@ def install(url, force, skip_migration=False, skip_package_migration=False): update_sonic_environment(bootloader, binary_image_version) + if isinstance(bootloader, AbootBootloader) and not skip_package_migration: + echo_and_log("Warning: SONiC package migration is not supported currenty on aboot platform due to https://github.com/Azure/sonic-buildimage/issues/7566.", LOG_ERR, fg="red") + skip_package_migration = True + if not skip_package_migration: migrate_sonic_packages(bootloader, binary_image_version)