mirror of https://git.48k.eu/ogclient
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.master
parent
493d998a4e
commit
abea6583d3
|
@ -36,7 +36,11 @@ def mount_mkdir(source, target):
|
||||||
Return True if mount is sucessful or if target is already a mountpoint.
|
Return True if mount is sucessful or if target is already a mountpoint.
|
||||||
"""
|
"""
|
||||||
if not os.path.exists(target):
|
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):
|
if not os.path.ismount(target):
|
||||||
return mount(source, target)
|
return mount(source, target)
|
||||||
|
|
Loading…
Reference in New Issue