@@ -232,17 +232,17 @@ def mount_squash_fs(squashfs_path, mount_point):
232
232
run_command_or_raise (["mount" , "-t" , "squashfs" , squashfs_path , mount_point ])
233
233
234
234
235
- def umount (mount_point , read_only = True , recursive = False , force = True , remove_dir = True ):
235
+ def umount (mount_point , read_only = True , recursive = False , force = True , remove_dir = True , raise_exception = True ):
236
236
flags = []
237
237
if read_only :
238
238
flags .append ("-r" )
239
239
if force :
240
240
flags .append ("-f" )
241
241
if recursive :
242
242
flags .append ("-R" )
243
- run_command_or_raise (["umount" , * flags , mount_point ])
243
+ run_command_or_raise (["umount" , * flags , mount_point ], raise_exception = raise_exception )
244
244
if remove_dir :
245
- run_command_or_raise (["rm" , "-rf" , mount_point ])
245
+ run_command_or_raise (["rm" , "-rf" , mount_point ], raise_exception = raise_exception )
246
246
247
247
248
248
def mount_overlay_fs (lowerdir , upperdir , workdir , mount_point ):
@@ -350,14 +350,18 @@ def get_path(path):
350
350
run_command_or_raise (["mount" , "--bind" ,
351
351
os .path .join (VAR_RUN_PATH , DOCKERD_SOCK ),
352
352
os .path .join (new_image_mount , "tmp" , DOCKERD_SOCK )])
353
+ run_command_or_raise (["chroot" , new_image_mount , "sh" , "-c" , "command -v {}" .format (SONIC_PACKAGE_MANAGER )])
354
+ except SonicRuntimeException as err :
355
+ echo_and_log ("Warning: SONiC Application Extension is not supported in this image: {}" .format (err ), LOG_ERR , fg = "red" )
356
+ else :
353
357
run_command_or_raise (["chroot" , new_image_mount , SONIC_PACKAGE_MANAGER , "migrate" ,
354
358
os .path .join ("/" , tmp_dir , packages_file ),
355
359
"--dockerd-socket" , os .path .join ("/" , tmp_dir , DOCKERD_SOCK ),
356
360
"-y" ])
357
361
finally :
358
- run_command ( "chroot {} {} stop" . format ( new_image_mount , DOCKER_CTL_SCRIPT ) )
359
- umount (new_image_mount , recursive = True , read_only = False , remove_dir = False )
360
- umount (new_image_mount )
362
+ run_command_or_raise ([ "chroot" , new_image_mount , DOCKER_CTL_SCRIPT , " stop"], raise_exception = False )
363
+ umount (new_image_mount , recursive = True , read_only = False , remove_dir = False , raise_exception = False )
364
+ umount (new_image_mount , raise_exception = False )
361
365
362
366
363
367
# Main entrypoint
0 commit comments