Enhanced get_mount_info() to recursively get the information
This commit is contained in:
parent
d3aec52d98
commit
6be071b6e0
|
|
@ -117,10 +117,13 @@ def harddrive(size=None, model=None, fuzzy=False):
|
||||||
|
|
||||||
|
|
||||||
def get_mount_info(path :Union[pathlib.Path, str]) -> dict:
|
def get_mount_info(path :Union[pathlib.Path, str]) -> dict:
|
||||||
try:
|
for traversal in list(map(str, [str(path)] + list(pathlib.Path(str(path)).parents))):
|
||||||
output = SysCommand(f'/usr/bin/findmnt --json {path}').decode('UTF-8')
|
try:
|
||||||
except SysCallError:
|
output = SysCommand(f'/usr/bin/findmnt --json {traversal}').decode('UTF-8')
|
||||||
return {}
|
if output:
|
||||||
|
break
|
||||||
|
except SysCallError:
|
||||||
|
pass
|
||||||
|
|
||||||
if not output:
|
if not output:
|
||||||
return {}
|
return {}
|
||||||
|
|
@ -132,6 +135,8 @@ def get_mount_info(path :Union[pathlib.Path, str]) -> dict:
|
||||||
|
|
||||||
return output['filesystems'][0]
|
return output['filesystems'][0]
|
||||||
|
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
def get_partitions_in_use(mountpoint) -> list:
|
def get_partitions_in_use(mountpoint) -> list:
|
||||||
from .partition import Partition
|
from .partition import Partition
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue