Fix local-column status dots always showing gray on the standby
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.
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user