Steps 4-6: the jobs, the set-up tab with generated scripts, Install the staged folder, site bundles and the campus template

- Overview jobs: Change the playlist, Add or remove a HyperDeck, Add a MIDI link, Add a computer,
  Make a PC program startable; 'Add a key for it' on unwatched Companion connections.
- Computers > Setup: steps with a [how] each and the set-up scripts generated per computer by
  settings/scripts.py from the templates in remote-access/ (no site-shaped value left in them);
  Remove this computer drops the fixes and checks that used it.
- Site setup > Site: the running and staged code, Install the staged folder (a one-shot launchd job
  running install.sh --keep-config, refused while live), Export site bundle (zip), New campus from a
  bundle (this campus's site block stays; every copied computer is flagged until touched).
- sites/: na -> the repo config, _template = the empty campus; install.sh --site <id>.
- Review reads appended checks as 'added'; tests for all of it.
- Deployed page-only to NA Ingest. (config.json, status_panel.py and readiness.py are left to the
  READY-page work in progress in the same tree.)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 14:53:08 -04:00
co-authored by Claude Fable 5.1
parent dafa14a512
commit a33e344cae
19 changed files with 804 additions and 59 deletions
+38
View File
@@ -212,6 +212,44 @@ class TestServer(unittest.TestCase):
self.assertEqual(self.put("/api/command", {"text": "rm -rf"}, method="POST")[0], 400)
self.assertEqual(self.put("/api/command", {"text": "test hd2 vista 0"}, method="POST")[0], 409) # no test while live
def test_setup_bundle_import_and_install_routes(self):
import io, zipfile
from test_apply import FakeLaunchctl # noqa: F401
self.site.attempts.clear()
st, raw = get(self.port, "/api/setup")
comps = json.loads(raw)["computers"]
self.assertEqual(st, 200)
self.assertEqual({c["alias"] for c in comps}, set(self.site.load()["hosts"]))
self.assertTrue(any(s["name"].startswith("Set-up script") for c in comps for s in c["scripts"]))
st, raw = get(self.port, "/api/site/bundle")
self.assertEqual(st, 200)
z = zipfile.ZipFile(io.BytesIO(raw))
self.assertIn("config.json", z.namelist())
bundle_cfg = json.loads(z.read("config.json"))
self.assertEqual(bundle_cfg["site"]["editing_code"], self.CODE) # the bundle is the real file
# a new campus from that bundle: this campus's own site block stays, computers are flagged
other = json.loads(json.dumps(bundle_cfg)); other["site"]["name"] = "Woonsocket"; other["site"]["editing_code"] = "theirs"
buf = io.BytesIO()
with zipfile.ZipFile(buf, "w") as z2:
z2.writestr("config.json", json.dumps(other))
req = urllib.request.Request("http://127.0.0.1:%d/api/site/import" % self.port, data=buf.getvalue(),
headers={"Content-Type": "application/octet-stream", "X-Edit-Key": self.CODE, "X-Editor": "sam"}, method="POST")
with urllib.request.urlopen(req, timeout=10) as r:
body = json.loads(r.read())
self.assertEqual(body["from"], "Woonsocket")
d = self.site.draft.read()
self.assertEqual(d["config"]["site"]["name"], self.site.load()["site"]["name"])
self.assertEqual(d["config"]["site"]["editing_code"], self.CODE)
self.assertTrue(all(h["notes"].startswith("copied from Woonsocket - check it") for h in d["config"]["hosts"].values()))
self.assertEqual(body["errors"], [])
self.put("/api/draft", {}, method="DELETE")
self.assertEqual(self.put("/api/site/import", {"nope": 1}, method="POST")[0], 400)
# the program: staged folder info is readable; an install is refused while live
st, raw = get(self.port, "/api/program/staged")
self.assertEqual(st, 200)
self.assertIn("running_version", json.loads(raw))
self.assertEqual(self.put("/api/program/install", {}, method="POST")[0], 409)
def test_probe_is_refused_while_a_fix_runs(self):
json.dump({"fix-x": {"key": "hd2"}}, open(os.path.join(self.data, "fixes-running.json"), "w"))
try: