Improved partition.uuid handling of lsblk information
This commit is contained in:
parent
e0782f234b
commit
fd904ca787
|
|
@ -145,8 +145,11 @@ class Partition:
|
||||||
it doesn't seam to be able to detect md raid partitions.
|
it doesn't seam to be able to detect md raid partitions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
lsblk = json.loads(SysCommand(f'lsblk -J -o+PARTUUID {self.path}').decode('UTF-8'))
|
partuuid_struct = SysCommand(f'lsblk -J -o+PARTUUID {self.path}')
|
||||||
for partition in lsblk['blockdevices']:
|
if not partuuid_struct.exit_code == 0:
|
||||||
|
raise DiskError(f"Could not get PARTUUID for {self.path}: {partuuid_struct}")
|
||||||
|
|
||||||
|
for partition in json.loads(partuuid_struct.decode('UTF-8'))['blockdevices']:
|
||||||
return partition.get('partuuid', None)
|
return partition.get('partuuid', None)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue