fix: log disk space retrieval errors to stderr instead of failing silently
This commit is contained in:
parent
c9eb1d37ee
commit
a8993a5a33
@ -150,7 +150,8 @@ def list_nfs_mounts():
|
|||||||
info['used_gb'] = round(used / (1024**3), 1)
|
info['used_gb'] = round(used / (1024**3), 1)
|
||||||
info['free_gb'] = round(free / (1024**3), 1)
|
info['free_gb'] = round(free / (1024**3), 1)
|
||||||
info['pct_used'] = int(used / total * 100) if total > 0 else 0
|
info['pct_used'] = int(used / total * 100) if total > 0 else 0
|
||||||
except Exception:
|
except Exception as e:
|
||||||
|
print(f"ERROR: failed to get disk space for {parts[1]}: {e}", file=sys.stderr)
|
||||||
info.update({'total_gb': 0, 'used_gb': 0, 'free_gb': 0, 'pct_used': 0})
|
info.update({'total_gb': 0, 'used_gb': 0, 'free_gb': 0, 'pct_used': 0})
|
||||||
mounts.append(info)
|
mounts.append(info)
|
||||||
except (FileNotFoundError, PermissionError):
|
except (FileNotFoundError, PermissionError):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user