Merge branch 'bugfix/disk-data' into tweak/dashboard-storage

This commit is contained in:
amcmanu3 2023-03-18 21:50:17 -04:00
commit 709539417f

View File

@ -191,21 +191,25 @@ class Stats:
# ENOENT, pop-up a Windows GUI error for a non-ready # ENOENT, pop-up a Windows GUI error for a non-ready
# partition or just hang. # partition or just hang.
continue continue
usage = psutil.disk_usage(part.mountpoint) try:
disk_data.append( usage = psutil.disk_usage(part.mountpoint)
{ disk_data.append(
"device": part.device, {
"total_raw": usage.total, "device": part.device,
"total": Helpers.human_readable_file_size(usage.total), "total_raw": usage.total,
"used_raw": usage.used, "total": Helpers.human_readable_file_size(usage.total),
"used": Helpers.human_readable_file_size(usage.used), "used_raw": usage.used,
"free_raw": usage.free, "used": Helpers.human_readable_file_size(usage.used),
"free": Helpers.human_readable_file_size(usage.free), "free_raw": usage.free,
"percent_used": usage.percent, "free": Helpers.human_readable_file_size(usage.free),
"fs": part.fstype, "percent_used": usage.percent,
"mount": part.mountpoint, "fs": part.fstype,
} "mount": part.mountpoint,
) }
)
except PermissionError:
logger.debug(f"Permission error accessing {part.mountpoint}")
continue
return disk_data return disk_data