#!/usr/bin/env python3
"""install_qb.py — Part 8 (R-1250): install a THROWAWAY qBittorrent on demo-hp guest 9201 through the endpoints the UI
invokes (box_walk). usage: SC=
TARGET=9201 DRIVE_ROOT=/mnt/felhom-drives/hdd_1 python3 -u install_qb.py"""
import os, sys
sys.path.insert(0, "/mnt/5_hdd/felhom.eu/git/felhom.eu/documentation/audits/catalog-sweep-2026-10-24/tools")
import box_walk as w
w.login()
code, d = w.ctl("GET", "/api/stacks/qbittorrent/deploy-fields")
print("deploy-fields:", code, [(f.get("env_var"), f.get("type"), f.get("required")) for f in ((((d.get("data") or {}).get("metadata") or {}).get("deploy_fields")) or [])])
ok = w.deploy("qbittorrent", "qbline")
print("deployed:", ok)
print("answers:", ok and w.wait_app("qbline", "/", tries=60, delay=5))