#!/usr/bin/env python3 # -*- coding: utf-8 -*- """SABnzbd's box step, run again after the fixture was fixed. The first attempt could not seed: `walk.GENERATED` holds no optional `type: secret` field, so the fixture had no API key (the controller generates that one itself). The fixture reads it from the app's own app.yaml now - the same place the household reads it. The app is already installed at the TO pin from that attempt, so the step starts by removing it and staging the FROM pin again: a ladder step has to begin where a household begins. """ import json import os import sys import time HERE = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, HERE) sys.path.insert(0, "/mnt/5_hdd/felhom.eu/git/felhom.eu/documentation/audits/pg-last-six-2026-09-30/tools") sys.path.insert(0, "/mnt/5_hdd/felhom.eu/git/app-catalog-felhom.eu/scripts") os.environ.setdefault("SC", "/tmp/usenet-walk") import walk as w # noqa: E402 import boxwalk_usenet as bw # noqa: E402 import boxstep_usenet as bs # noqa: E402 APP, SUB = "sabnzbd", "usenet" w.login() st = w.stack(APP) if st.get("deployed"): w.say("removing the install from the first attempt (a ladder step starts where a household starts)") w.remove(APP) time.sleep(5) w.say("staging the FROM pin again") import stage_in_cache as stage # noqa: E402 stage.stage("frm") time.sleep(5) ok = w.deploy(APP, SUB, extra_values={"HDD_PATH": bw.DRIVE_ROOT}) w.say(f"deploy -> {ok}") if not ok: raise SystemExit("the install did not succeed") w.say(f"the app answers: {w.wait_app(SUB, '/', want=('200', '303', '401', '403'), tries=40, delay=5)}") # the key the household was given, read the way the fixture now reads it import upgrade_fixtures_box as fxb # noqa: E402 fx = fxb.FIXTURES[APP] w.say(f"the API key is readable: {bool(fx._key(w))} (length {len(fx._key(w))})") v = bs.step(APP) json.dump(v, open(os.path.join(bs.EV, "box-steps-sabnzbd.json"), "w"), indent=2, ensure_ascii=False) print(json.dumps(v, indent=2, ensure_ascii=False))