Fix MapperDev.subvolumes (#1249)
* Fixed a silent try/except, and MapperDev.subvolumes should now work. * MapperDev.subvolumes now properly sends a pathlib.Path.
This commit is contained in:
parent
e19ef44630
commit
353c05318c
|
|
@ -112,8 +112,8 @@ def subvolume_info_from_path(path :pathlib.Path) -> Optional[BtrfsSubvolume]:
|
||||||
|
|
||||||
return BtrfsSubvolume(**{'full_path' : path, 'name' : subvolume_name, **result})
|
return BtrfsSubvolume(**{'full_path' : path, 'name' : subvolume_name, **result})
|
||||||
|
|
||||||
except SysCallError:
|
except SysCallError as error:
|
||||||
pass
|
log(f"Could not retrieve subvolume information from {path}: {error}", level=logging.WARNING, fg="orange")
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,8 @@ class MapperDev:
|
||||||
@property
|
@property
|
||||||
def subvolumes(self) -> Iterator['BtrfsSubvolume']:
|
def subvolumes(self) -> Iterator['BtrfsSubvolume']:
|
||||||
from .btrfs import subvolume_info_from_path
|
from .btrfs import subvolume_info_from_path
|
||||||
|
|
||||||
for mountpoint in self.mount_information:
|
for mountpoint in self.mount_information:
|
||||||
if subvolume := subvolume_info_from_path(mountpoint):
|
if target := mountpoint.get('target'):
|
||||||
yield subvolume
|
if subvolume := subvolume_info_from_path(pathlib.Path(target)):
|
||||||
|
yield subvolume
|
||||||
Loading…
Reference in New Issue