Skip to content

Commit

Permalink
[armhf][sonic-installer] [cherry-pick to branch 202012] Fix the issue…
Browse files Browse the repository at this point in the history
… of sonic-installer list after set-default and cleanup (#2479) (#2497)

What I did
sonic-installer list will throw a exception when install images as the following step

(onie-nos-install ) Install first image A
(sonic-installer) Install Image B and not reboot it
(sonic-installer) set default to back to Image A
sudo sonic-installer cleanup
At this time, executing sonic-installer list will throw exception

How I did it
Modify the get_next_image() in uboot.py to check and return index 1 when the images list contains two elements.
This PR should work with sonic-net/sonic-buildimage#12609

This PR is needed by branch 202012 and 2022o5

Signed-off-by: mlok <marty.lok@nokia.com>
(cherry picked from commit d1ca2cd)
  • Loading branch information
mlok-nokia authored Nov 16, 2022
1 parent 304a2a5 commit 1083729
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sonic_installer/bootloader/uboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_next_image(self):
proc = subprocess.Popen("/usr/bin/fw_printenv -n boot_next", shell=True, text=True, stdout=subprocess.PIPE)
(out, _) = proc.communicate()
image = out.rstrip()
if "sonic_image_2" in image:
if "sonic_image_2" in image and len(images) == 2:
next_image_index = 1
else:
next_image_index = 0
Expand Down

0 comments on commit 1083729

Please sign in to comment.