Skip to content

Commit

Permalink
Added try catch for verify_image_sign
Browse files Browse the repository at this point in the history
Added try-catch wrapper for verify_image_sign to fix method not implemented in non-grub bootloaders.
  • Loading branch information
ycoheNvidia committed Feb 23, 2023
1 parent c57c3fa commit ccdd0c7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions sonic_installer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,11 +579,14 @@ def install(url, force, skip_platform_check=False, skip_migration=False, skip_pa

# Calling verification script by default - signature will be checked if enabled in bios
echo_and_log("Verifing image {} signature...".format(binary_image_version))
if not bootloader.verify_image_sign(image_path):
echo_and_log('Error: Failed verify image signature', LOG_ERR)
raise click.Abort()
else:
echo_and_log('Verification successful')
try:
if not bootloader.verify_image_sign(image_path):
echo_and_log('Error: Failed verify image signature', LOG_ERR)
raise click.Abort()
else:
echo_and_log('Verification successful')
except Exception as e:
echo_and_log("Image signature verification not implemented for the current bootloader", e)

echo_and_log("Installing image {} and setting it as default...".format(binary_image_version))
with SWAPAllocator(not skip_setup_swap, swap_mem_size, total_mem_threshold, available_mem_threshold):
Expand Down

0 comments on commit ccdd0c7

Please sign in to comment.