From 2c10b4c92afc80441493ad9b239952b43d2b761e Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Thu, 25 Jul 2024 10:03:55 +0200 Subject: utils: fs: error out if mkfs fails If formatting fails, log shows: mkfs.ntfs reports return code 1 for /dev/sda2 but ogclient reports success to the ogserver. Raise an exception so front-end gets an indication that formatting has failed. --- src/live/ogOperations.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/live') diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index 44d8f1b..15e563f 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -429,9 +429,12 @@ class OgLiveOperations: partition = int(part["partition"]) if fs == 'cache': - mkfs('ext4', int(disk), partition, label='CACHE') + err = mkfs('ext4', int(disk), partition, label='CACHE') else: - mkfs(fs, int(disk), partition) + err = mkfs(fs, int(disk), partition) + + if err == -1: + raise OgError(f'Failed to format {part["partition"]} with filesystem {part["filesystem"]}') ret = subprocess.run(['partprobe', f'/dev/{diskname}']) logging.info(f'second partprobe /dev/{diskname} reports {ret.returncode}') -- cgit v1.2.3-18-g5258