Return better value for data drive usage if drive not mounted

This commit is contained in:
Taylor Helsper 2022-03-31 22:56:35 -05:00
parent 9c870f815a
commit 489019345c

View File

@ -57,8 +57,11 @@ def get_data_drive_usage():
return get_cached_data("data_drive_usage") return get_cached_data("data_drive_usage")
usage = "0%" usage = "0%"
try: try:
usage = to_string(subprocess.check_output("df -h /mnt/hdd | grep /dev | awk '{print $5}'", shell=True)) if is_mynode_drive_mounted():
update_cached_data("data_drive_usage", usage) usage = to_string(subprocess.check_output("df -h /mnt/hdd | grep /dev | awk '{print $5}'", shell=True))
update_cached_data("data_drive_usage", usage)
else:
return "N/A"
except: except:
return usage return usage
return usage return usage