diff options
Diffstat (limited to 'src/utils/fs.py')
-rw-r--r-- | src/utils/fs.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/utils/fs.py b/src/utils/fs.py index 7e1d115..83d8d47 100644 --- a/src/utils/fs.py +++ b/src/utils/fs.py @@ -10,6 +10,7 @@ import logging import os import subprocess import shlex +from src.log import OgError from subprocess import DEVNULL, PIPE, STDOUT @@ -148,12 +149,12 @@ def mkfs(fs, disk, partition, label=None): } if fs not in fsdict: - raise ValueError(f'mkfs failed, unsupported target filesystem {fs}') + raise OgError(f'mkfs failed, unsupported target filesystem {fs}') try: partdev = get_partition_device(disk, partition) except ValueError as e: - raise ValueError(f'mkfs aborted: {e}') from e + raise OgError(f'mkfs aborted: {e}') from e fsdict[fs](partdev, label) @@ -249,11 +250,11 @@ def _reduce_ntfsresize(partdev): data_split = output_data.split(pattern) # If we fail to match pattern in the split then data_split will contain [output_data] if len(data_split) == 1: - raise ValueError(f'nfsresize: failed to find: {pattern}') + raise OgError(f'nfsresize: failed to find: {pattern}') value_str = data_split[1].split(' ')[0] if not value_str.isdigit() or value_str.startswith('-'): - raise ValueError(f'nfsresize: failed to parse numeric value at {pattern}') + raise OgError(f'nfsresize: failed to parse numeric value at {pattern}') return int(value_str) try: @@ -307,11 +308,11 @@ def _extend_resize2fs(partdev): cmd = shlex.split(f'resize2fs -f {partdev}') proc = subprocess.run(cmd) if proc.returncode != 0: - raise RuntimeError(f'Error growing ext4 filesystem at {partdev}') + raise OgError(f'Error growing ext4 filesystem at {partdev}') def _extend_ntfsresize(partdev): cmd = shlex.split(f'ntfsresize -f {partdev}') proc = subprocess.run(cmd, input=b'y') if proc.returncode != 0: - raise RuntimeError(f'Error growing ntfs filesystem at {partdev}') + raise OgError(f'Error growing ntfs filesystem at {partdev}') |