Remove superfluous try in get_btrfs_info() (#3010)

This commit is contained in:
codefiles 2024-12-07 17:01:51 -05:00 committed by GitHub
parent 1d278f8abd
commit ae3b0f8d75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 11 deletions

View File

@ -239,17 +239,13 @@ class DeviceHandler:
# to the corresponding mountpoints # to the corresponding mountpoints
btrfs_subvol_info = dict(zip(lsblk_info.fsroots, lsblk_info.mountpoints)) btrfs_subvol_info = dict(zip(lsblk_info.fsroots, lsblk_info.mountpoints))
try: # ID 256 gen 16 top level 5 path @
# ID 256 gen 16 top level 5 path @ for line in result.splitlines():
for line in result.splitlines(): # expected output format:
# expected output format: # ID 257 gen 8 top level 5 path @home
# ID 257 gen 8 top level 5 path @home name = Path(line.split(' ')[-1])
name = Path(line.split(' ')[-1]) sub_vol_mountpoint = btrfs_subvol_info.get(name, None)
sub_vol_mountpoint = btrfs_subvol_info.get(name, None) subvol_infos.append(_BtrfsSubvolumeInfo(name, sub_vol_mountpoint))
subvol_infos.append(_BtrfsSubvolumeInfo(name, sub_vol_mountpoint))
except json.decoder.JSONDecodeError as err:
error(f"Could not decode lsblk JSON: {result}")
raise err
if not lsblk_info.mountpoint: if not lsblk_info.mountpoint:
self.umount(dev_path) self.umount(dev_path)