#!/usr/bin/env python3 """setaside_probe.py — hub v0.171.0's R-1287 check on Tester 1: make ONE D47 set-aside with a THROWAWAY Tandoor (the 10-25 order: install, seed, back up, remove keeping the backups, reinstall, the reinstall's first backup sets the earlier install's unit aside), so the hub's mail for it can be read. Endpoint-level, the requests the pages send. Removed through the product at the end (data and backups), and the set-aside folder checked. usage: SC= SWEEP_EV= TARGET=tester-1 python3 setaside_probe.py""" import json, os, sys, time TOOLS = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../catalog-sweep-2026-10-24/tools") sys.path.insert(0, TOOLS) import sweep as sw # noqa: E402 w, fxm = sw.w, sw.fxm APP = "tandoor" def main(): d = os.path.join(sw.EV, "_setaside") os.makedirs(d, exist_ok=True) log = open(os.path.join(d, "walk.log"), "a") def say(*a): line = time.strftime("%H:%M:%SZ", time.gmtime()) + " " + " ".join(str(x) for x in a) print(line, flush=True) log.write(sw.scrub(line) + "\n") log.flush() w.say = say fx = fxm.FIXTURES[APP] sub = getattr(fx, "sub", APP) rec = {"app": APP} w.login() t_start = int(time.time()) try: rec["install"] = w.deploy(APP, sub) and w.wait_app(sub, "/", tries=90, delay=5) rec["seed"] = bool(fx.seed(w, sub, say)) sw.backup_now(rec, say) sw.remove(APP, keep=True, say=say) t_re = time.time() rec["reinstall"] = w.deploy(APP, sub, dict(w.GENERATED.get(APP) or {})) aside = "" for _ in range(60): time.sleep(10) aside = sw.g(f"docker logs --since {int(t_re)} felhom-controller 2>&1 | grep -E '{APP}: the recovery unit of an earlier install' | cut -c1-300") if aside.strip(): break rec["set_aside_line"] = aside.strip() rec["set_aside_at"] = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()) say(" set aside: " + (aside.strip()[:260] or "NONE within 10 min")) finally: rec["controller_lines"] = sw.scrub(sw.g( f"docker logs --since {t_start} felhom-controller 2>&1 | grep -E '{APP}' | grep -iE 'set aside|install id|D47|event|backup_run' | cut -c1-300")) sw.remove(APP, keep=False, say=say) rec["after_remove"] = sw.leftovers(APP, sub) rec["set_aside_after_remove"] = sw.g(f"ls -1 /mnt/*/felhom-data/backups/set-aside/{APP} 2>&1 | head -3").strip() json.dump(rec, open(os.path.join(d, "record.json"), "w"), ensure_ascii=False, indent=1) if __name__ == "__main__": main()