Skip to content

Commit b1097b2

Browse files
authored
[fwutil]: Fix next image mount (sonic-net#1533)
- What I did Fixed next image mount - How I did it Removed lstrip - How to verify it root@sonic:/home/admin# fwutil update chassis component <component_name> fw -i next Signed-off-by: Nazarii Hnydyn <[email protected]>
1 parent 305a3e4 commit b1097b2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

fwutil/lib.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,10 @@ class SquashFs(object):
210210
OVERLAY_MOUNTPOINT_TEMPLATE = "/tmp/image-{}-overlay"
211211

212212
def __init__(self):
213-
image_stem = self.next_image.lstrip(self.OS_PREFIX)
213+
image_stem = self.next_image
214+
215+
if image_stem.startswith(self.OS_PREFIX):
216+
image_stem = image_stem[len(self.OS_PREFIX):]
214217

215218
self.fs_path = self.FS_PATH_TEMPLATE.format(image_stem)
216219
self.fs_rw = self.FS_RW_TEMPLATE.format(image_stem)
@@ -245,6 +248,9 @@ def mount_next_image_fs(self):
245248
)
246249
subprocess.check_call(cmd, shell=True)
247250

251+
if not (os.path.exists(self.fs_rw) and os.path.exists(self.fs_work)):
252+
return self.fs_mountpoint
253+
248254
os.mkdir(self.overlay_mountpoint)
249255
cmd = "mount -n -r -t overlay -o lowerdir={},upperdir={},workdir={} overlay {}".format(
250256
self.fs_mountpoint,

0 commit comments

Comments
 (0)