diff --git a/platform/modules/backups.py b/platform/modules/backups.py index a1517f2..62d6a16 100644 --- a/platform/modules/backups.py +++ b/platform/modules/backups.py @@ -241,8 +241,26 @@ def _with_status(names, sidecars): return result +def _fetch_local_sidecars(): + """Same local-dir-first-else-SSH pattern as _fetch_vm_sidecars() below, + but for /root/backups on the main server. _load_local_sidecars() alone + has no such fallback — a plain glob.glob() against a hardcoded path — + so on the standby (where /root/backups doesn't exist locally at all) + it silently returned {}, and every local-column status dot rendered as + gray/unknown regardless of the backup's real status.""" + if os.path.isdir('/root/backups'): + return _load_local_sidecars('/root/backups') + cmd = ( + "for f in /root/backups/*.tar.gz.meta.json; do " + "[ -f \"$f\" ] && echo \"===META:$(basename \"$f\")===\" && cat \"$f\"; " + "done 2>/dev/null" + ) + stdout, _ = _ssh_main(cmd, timeout=25) + return _parse_vm_sidecars(stdout) + + def get_local_backups_with_status(): - return _with_status(get_local_backups(), _load_local_sidecars()) + return _with_status(get_local_backups(), _fetch_local_sidecars()) def get_vm_backups_with_status():