1cedf94d6b
gates / gates (push) Successful in 29s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
34 lines
2.2 KiB
Python
34 lines
2.2 KiB
Python
import json, sys, time
|
|
sys.path.insert(0, ".")
|
|
import walk as w, fixtures as fx, ncfiles as nf
|
|
F, SUB, APP = fx.Nextcloud(), "cloud-a1", "nextcloud"
|
|
S = json.load(open(f"{w.SC}/a1-secret-state.json"))
|
|
A, files = S["A"], S["files"]
|
|
names = sorted(files)
|
|
w.login()
|
|
out = {}
|
|
c, d = w.ctl("GET", "/api/backup/restore-status")
|
|
out["restore_status"] = d
|
|
w.say("restore-status: " + json.dumps(d, ensure_ascii=False)[:600])
|
|
out["log"] = w.guest("docker logs --since 2026-09-24T10:24:55Z felhom-controller 2>&1 | grep -iE 'whole restore|WHOLE restore|Tier-2 whole|Restore-from-unit completed|hold .*CLEARED|Restoring Docker volume' | cut -c1-330 | tail -10")
|
|
w.say("log:\n" + out["log"])
|
|
w.wait_app(SUB, "/status.php", want=("200",), tries=60, delay=5)
|
|
out["account"] = bool(F.verify(w, SUB, A, w.say))
|
|
# file 0 was DELETED after the copy (must come back); file 1 was EDITED after the copy (newer — must stay edited)
|
|
c0, b0 = nf.get(w, SUB, A, names[0]); c1, b1 = nf.get(w, SUB, A, names[1]); c2, b2 = nf.get(w, SUB, A, names[2])
|
|
out["file0_back"] = (c0 == "200" and b0 == files[names[0]])
|
|
out["file1_kept_edit"] = (c1 == "200" and b1.startswith("edited by the household"))
|
|
out["file2_unchanged"] = (c2 == "200" and b2 == files[names[2]])
|
|
w.say(f"file0 (deleted after the copy) back={out['file0_back']} ({c0}); file1 (edited after the copy) kept the edit={out['file1_kept_edit']}; file2 unchanged={out['file2_unchanged']}")
|
|
out["occ_scan"] = w.guest(f"docker exec -u www-data nextcloud php occ files:scan {A['uid']} 2>&1 | tail -4")
|
|
w.say("occ files:scan (the app sees its files): " + out["occ_scan"])
|
|
c0b, b0b = nf.get(w, SUB, A, names[0])
|
|
out["file0_back_after_scan"] = (c0b == "200" and b0b == files[names[0]])
|
|
w.say(f"file0 after occ scan: {c0b} {out['file0_back_after_scan']}")
|
|
out["kept_beside"] = w.guest("find /mnt/felhom-drives/scratch_hdd/userdata/nextcloud -name '*.felhom-*' | sed 's|.*/||'")
|
|
st = w.stack(APP)
|
|
out["final"] = {k: st.get(k) for k in ("state", "hold_reason", "update_phase")}
|
|
w.say("final " + json.dumps(out["final"], ensure_ascii=False) + " | kept beside: " + repr(out["kept_beside"]))
|
|
json.dump(out, open("../A1/21-readback.json", "w"), indent=2, ensure_ascii=False, default=str)
|
|
open("../A1/21-readback.log", "w").write("\n".join(w.LOG) + "\n")
|