index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton.feeds@gmail.com> | 2021-11-18 15:33:21 +0000 |
---|---|---|
committer | Anton Hvornum <anton.feeds@gmail.com> | 2021-11-18 15:33:21 +0000 |
commit | 96332670c3f58770c7529aa0ef4fc96760172199 (patch) | |
tree | 7681da326a750d1f22e5802480781e0edd154e5c /archinstall | |
parent | ee2eba6baff4b94a6a0d6ab26aae9c4f084a55c6 (diff) |
-rw-r--r-- | archinstall/lib/disk/partition.py | 19 |
diff --git a/archinstall/lib/disk/partition.py b/archinstall/lib/disk/partition.py index 0d72f6ab..f8378d47 100644 --- a/archinstall/lib/disk/partition.py +++ b/archinstall/lib/disk/partition.py @@ -160,11 +160,20 @@ class Partition: raise DiskError(f"Could not get PARTUUID for {self.path} using 'lsblk -J -o+PARTUUID {self.path}'") - def _safe_uuid(self): - try: - return self.uuid - except DiskError: - return None + @property + def _safe_uuid(self) -> Optional[str]: + """ + A near copy of self.uuid but without any delays. + This function should only be used where uuid is not crucial. + For instance when you want to get a __repr__ of the class. + """ + self.partprobe() + + partuuid_struct = SysCommand(f'lsblk -J -o+PARTUUID {self.path}') + if partuuid_struct.exit_code == 0: + if partition_information := next(iter(json.loads(partuuid_struct.decode('UTF-8'))['blockdevices']), None): + if (partuuid := partition_information.get('partuuid', None)): + return partuuid @property def encrypted(self): |