From 7ddce24e6248745e90e12b6e48c502b739322af2 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 21 Aug 2026 14:32:01 +0200 Subject: [PATCH] Fix local-column status dots always showing gray on the standby MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit get_local_backups_with_status() called _load_local_sidecars() directly, which is a plain glob.glob('/root/backups/*.tar.gz.meta.json') with no SSH-fallback awareness at all — unlike get_local_backups() itself (fixed earlier this session) and _fetch_vm_sidecars() (already had this pattern from day one). On the standby, /root/backups doesn't exist locally, so the glob silently returned {} and every local-column entry fell through to the 'unknown' (gray) default regardless of its real status, while the VM column worked correctly since _fetch_vm_sidecars() already had the fallback. Added _fetch_local_sidecars() mirroring _fetch_vm_sidecars()'s exact local-dir-first-else-SSH pattern, targeting /root/backups on the main server via the now-working tunnel instead of the VM's own backup dir. Verified on the live standby: local column now shows green for backups with a sidecar and gray only for the legacine ones that genuinely predate the sidecar feature (documented, intended behavior) — not gray across the board. --- platform/modules/backups.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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():