diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-05-07 16:42:55 +0200 |
---|---|---|
committer | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-05-07 17:24:41 +0200 |
commit | abea6583d3d9cef9b1187e9fcfdfc1bb4bfcce25 (patch) | |
tree | dd954962221bf0fee6d5d63baf3560724a24d7bb /src/utils | |
parent | 493d998a4edad1b78cecc0e53fbc0629ec3735cf (diff) |
utils: add mkdir error report in mount_mkdir
Add exception checks to the os.mkdir operation and log the error
found. The previous implementation was too optimistic and only
handled mount related errors.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/fs.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/utils/fs.py b/src/utils/fs.py index 184b47a..766c09b 100644 --- a/src/utils/fs.py +++ b/src/utils/fs.py @@ -36,7 +36,11 @@ def mount_mkdir(source, target): Return True if mount is sucessful or if target is already a mountpoint. """ if not os.path.exists(target): - os.mkdir(target) + try: + os.mkdir(target) + except OSError as e: + logging.error(f'mkdir operation failed. Reported {e}') + return False if not os.path.ismount(target): return mount(source, target) |