handle systems with no labelled devices
This commit is contained in:
parent
4b6a059f1d
commit
51d1cd1926
1 changed files with 6 additions and 2 deletions
|
@ -547,7 +547,11 @@ class StatsPart(Part):
|
|||
names = []
|
||||
first_mountpoint = True
|
||||
btrfs_encountered_devices = set()
|
||||
|
||||
if os.path.isdir("/dev/disk/by-label"):
|
||||
device_to_label = {os.path.join("/dev", os.path.basename(os.readlink(os.path.join("/dev/disk/by-label", x)))): x for x in os.listdir("/dev/disk/by-label")}
|
||||
else:
|
||||
device_to_label = {}
|
||||
|
||||
with open("/proc/self/mounts") as f:
|
||||
for line in f:
|
||||
|
@ -585,7 +589,7 @@ class StatsPart(Part):
|
|||
continue
|
||||
|
||||
btrfs_encountered_devices.add(device)
|
||||
short_name = " "+device_to_label[device][0]
|
||||
if device in device_to_label: short_name = " "+device_to_label[device][0]
|
||||
|
||||
btrfs_raw = command(["/sbin/btrfs", "fi", "usage", "-b", dir])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue