summaryrefslogtreecommitdiffstats
path: root/src/live
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2024-07-25 10:03:55 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-07-29 14:22:48 +0200
commit2c10b4c92afc80441493ad9b239952b43d2b761e (patch)
treedcf0712cd8795e9a5ddaf1ac528edffee5d0905b /src/live
parent59fa3bb120a36c231579eab757b6e54ff62c51b7 (diff)
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.
Diffstat (limited to 'src/live')
-rw-r--r--src/live/ogOperations.py7
1 files changed, 5 insertions, 2 deletions
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}')