refs #2506 -- Add error handling for the case where the disk can't be found

pull/108/head
Vadim vtroshchinskiy 2025-08-28 09:55:22 +02:00
parent 012b7a5dbb
commit cf17d765a0
3 changed files with 7 additions and 0 deletions

View File

@ -42,6 +42,9 @@ def create_image(disk_num, partition_num, repo, image_name):
og_git.progress_callback = OgProgressPrinterWeb()
device = DiskLib.ogDiskToDev(disk_num, partition_num)
if device is None:
sys.exit(SystemLib.ogRaiseError([], ogGlobals.OG_ERR_FORMAT, f"Failed to translate disk {disk_num} partition {partition_num} to a device"))
if og_git.initRepo(device, image_name):
return 0
else:

View File

@ -74,6 +74,8 @@ def commit_image(disk_num, partition_num, repository, branch, options, msg):
og_git.progress_callback = OgProgressPrinterWeb()
device = DiskLib.ogDiskToDev(disk_num, partition_num)
if device is None:
sys.exit(SystemLib.ogRaiseError([], ogGlobals.OG_ERR_FORMAT, f"Failed to translate disk {disk_num} partition {partition_num} to a device"))
force_push = False
opts = options.split(",")

View File

@ -91,6 +91,8 @@ if __name__ == "__main__":
og_git.progress_callback = OgProgressPrinterWeb()
device = DiskLib.ogDiskToDev(args.disk, args.partition)
if device is None:
sys.exit(SystemLib.ogRaiseError([], ogGlobals.OG_ERR_FORMAT, f"Failed to translate disk {args.disk} partition {args.partition} to a device"))
og_git.cloneRepo(args.image_name, destination = device, boot_device = device, ref = args.commit, branch = args.branch)