diff options
author | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-02-15 10:45:46 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-02-15 16:58:51 +0100 |
commit | 8fb8a0a66dabb5675cc82b37adfd14d00fda6f40 (patch) | |
tree | 822dc83b8b582104605d183b5ac142720c6bc052 | |
parent | bf7eb1542ddb802020dd3bce0fa9e3972474c8b9 (diff) |
fs: return unknown if blkid fails
instead of rising an exception
-rw-r--r-- | src/utils/fs.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/utils/fs.py b/src/utils/fs.py index 77f8b75..5bc7956 100644 --- a/src/utils/fs.py +++ b/src/utils/fs.py @@ -97,6 +97,8 @@ def ogReduceFs(disk, part): """ partdev = get_partition_device(disk, part) fstype = get_filesystem_type(partdev) + if fstype == "unknown": + return -1 umount(partdev) if fstype == 'ext4': @@ -117,6 +119,8 @@ def ogExtendFs(disk, part): """ partdev = get_partition_device(disk, part) fstype = get_filesystem_type(partdev) + if fstype == "unknown": + return -1 umount(partdev) if fstype == 'ext4': @@ -198,7 +202,9 @@ def get_filesystem_type(partdev): cmd = shlex.split(f'blkid -o value -s TYPE {partdev}') proc = subprocess.run(cmd, stdout=PIPE, encoding='utf-8') if proc.returncode != 0: - raise RuntimeError(f'Error getting filesystem from {partdev}') + log.error(f'Error getting filesystem from {partdev}') + return "unknown" + return proc.stdout.strip() |