Forgot option PARTUUID to lsblk

This commit is contained in:
Anton Hvornum 2021-04-03 18:34:51 +02:00
parent cba30b9e26
commit bf4c32e2e0
1 changed files with 2 additions and 2 deletions

View File

@ -197,9 +197,9 @@ class Partition():
This is more reliable than relying on /dev/disk/by-partuuid as This is more reliable than relying on /dev/disk/by-partuuid as
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 = b''.join(sys_command(f'lsblk -J {self.path}')) lsblk = b''.join(sys_command(f'lsblk -J -o+PARTUUID {self.path}'))
for partition in json.loads(lsblk.decode('UTF-8'))['blockdevices']: for partition in json.loads(lsblk.decode('UTF-8'))['blockdevices']:
return partition['partuuid'] return partition.get('partuuid', None)
@property @property
def encrypted(self): def encrypted(self):