Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SONiC installer - check new image type before checking installed version and small improvements #1196

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions sonic_installer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,20 +305,20 @@ def install(url, force, skip_migration=False):
click.echo("Image file does not exist or is not a valid SONiC image file")
raise click.Abort()

# Verify that the binary image is of the same type as the running image
if not bootloader.verify_binary_image(image_path) and not force:
click.echo("Image file {} is of a different type than running image.\n".format(url) +\
"If you are sure you want to install this image, use -f|--force.\n" +\
"Aborting...")
raise click.Abort()

# Is this version already installed?
if binary_image_version in bootloader.get_installed_images():
click.echo("Image {} is already installed. Setting it as default...".format(binary_image_version))
if not bootloader.set_default_image(binary_image_version):
click.echo('Error: Failed to set image as default')
raise click.Abort()
else:
# Verify that the binary image is of the same type as the running image
if not bootloader.verify_binary_image(image_path) and not force:
click.echo("Image file '{}' is of a different type than running image.\n"
"If you are sure you want to install this image, use -f|--force.\n"
"Aborting...".format(image_path))
raise click.Abort()

click.echo("Installing image {} and setting it as default...".format(binary_image_version))
bootloader.install_image(image_path)
# Take a backup of current configuration
Expand Down