Converted paths to pathlib.Path and mount points to detect properly (#1412)
* Converted a path to pathlib.Path * Using Partition.mountpoints instead of Partition.mountpoint * Update mapperdev.py * Added .mountpoints to MapperDev * Spelling error
This commit is contained in:
parent
a31bf94fa3
commit
437ac124c6
|
|
@ -403,6 +403,10 @@ def get_partitions_in_use(mountpoint :str) -> Dict[str, Any]:
|
||||||
log(f'Filtering available mounts {block_devices_mountpoints} to those under {mountpoint}', level=logging.DEBUG)
|
log(f'Filtering available mounts {block_devices_mountpoints} to those under {mountpoint}', level=logging.DEBUG)
|
||||||
|
|
||||||
for mountpoint in list(get_all_targets(output['filesystems']).keys()):
|
for mountpoint in list(get_all_targets(output['filesystems']).keys()):
|
||||||
|
# Since all_blockdevices() returns PosixPath objects, we need to convert
|
||||||
|
# findmnt paths to pathlib.Path() first:
|
||||||
|
mountpoint = pathlib.Path(mountpoint)
|
||||||
|
|
||||||
if mountpoint in block_devices_mountpoints:
|
if mountpoint in block_devices_mountpoints:
|
||||||
if mountpoint not in mounts:
|
if mountpoint not in mounts:
|
||||||
mounts[mountpoint] = block_devices_mountpoints[mountpoint]
|
mounts[mountpoint] = block_devices_mountpoints[mountpoint]
|
||||||
|
|
|
||||||
|
|
@ -64,10 +64,14 @@ class MapperDev:
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def mountpoints(self) -> List[Dict[str, Any]]:
|
||||||
|
return [obj['target'] for obj in self.mount_information]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mount_information(self) -> List[Dict[str, Any]]:
|
def mount_information(self) -> List[Dict[str, Any]]:
|
||||||
from .helpers import find_mountpoint
|
from .helpers import find_mountpoint
|
||||||
return list(find_mountpoint(self.path))
|
return [{**obj, 'target' : pathlib.Path(obj.get('target', '/dev/null'))} for obj in find_mountpoint(self.path)]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def filesystem(self) -> Optional[str]:
|
def filesystem(self) -> Optional[str]:
|
||||||
|
|
|
||||||
|
|
@ -1000,9 +1000,9 @@ class Installer:
|
||||||
root_partition = None
|
root_partition = None
|
||||||
for partition in self.partitions:
|
for partition in self.partitions:
|
||||||
print(partition, [partition.mountpoint], [self.target])
|
print(partition, [partition.mountpoint], [self.target])
|
||||||
if partition.mountpoint == self.target / 'boot':
|
if self.target / 'boot' in partition.mountpoints:
|
||||||
boot_partition = partition
|
boot_partition = partition
|
||||||
elif partition.mountpoint == self.target:
|
elif self.target in partition.mountpoints:
|
||||||
root_partition = partition
|
root_partition = partition
|
||||||
|
|
||||||
if boot_partition is None or root_partition is None:
|
if boot_partition is None or root_partition is None:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue