Step 0 of the settings page: registry, safe restart, remembered state, test verb, page markers
- schema.py: every setting with type, default, help, owner screen and the rules a config must pass; tests/test_schema.py keeps it in step with the code (every key the code reads is declared, every default matches, check types and fix kinds agree, the glossary covers every word a key can show, today's config still builds today's pages apart from the key notes) - status_panel.py: VERSION + started.json; SIGTERM lets a running fix finish and starts nothing new (RESTARTING SOON); fixes-running.json and live-now.json for the settings page; state.json keeps the ALARMS override, acknowledgements, auto-fix tries and fix times across restarts, keyed by what a check is about rather than its position; 'test' and 'resurvey' commands; queued commands dropped at start; overnight windows; a HyperDeck switched off is always switched back on; the spotify fix kind (playlist set once, in config 'spotify'); Windows remote checks batched for cmd.exe with conditional echoes; every fix's kind and host validated; never_auto; wording and numbers from config (site block, timing, page_hold_ms, auto-fix keep_months); hyperdeck_probe removed; --check and --exit-timeout - make_page.py: numbers from config, markers on every key, nav templates per Companion version, --out; push_page.py: a page is overwritten only when every key carries a marker (foreign keys named by position), secret-free fetch, host from the site; nav_keys.py: host from the site; netgear.py: switches and the shared-port limit from config - install.sh: validates with the new code first, keeps prev/ for --rollback, --keep-config, derived ExitTimeOut, wider deploy list, waits for the start stamp - config.json: site, timing, spotify sections; Windows hosts marked; deployed to NA Ingest and both pages re-imported once (--force) so every key carries its marker Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+15
-2
@@ -18,10 +18,23 @@ import subprocess
|
||||
import sys
|
||||
import telnetlib # stdlib in the macOS python3 (3.9)
|
||||
|
||||
SWITCHES = ["10.66.1.100", "10.66.1.102"]
|
||||
SWITCHES = ["10.66.1.100", "10.66.1.102"] # the CLI's default; the watchdog passes "dante_switches" from config
|
||||
KEYCHAIN_SERVICE = "netgear-status-panel"
|
||||
|
||||
|
||||
def config_switches():
|
||||
""""dante_switches" from this folder's config.json, for the command line (the watchdog passes its own)."""
|
||||
import json, os
|
||||
try:
|
||||
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.json")) as f:
|
||||
cfg = json.load(f)
|
||||
global MAX_SHARED
|
||||
MAX_SHARED = cfg.get("dante_max_shared", MAX_SHARED)
|
||||
return cfg.get("dante_switches") or SWITCHES
|
||||
except (OSError, ValueError):
|
||||
return SWITCHES
|
||||
|
||||
|
||||
def credentials(service=KEYCHAIN_SERVICE):
|
||||
attrs = subprocess.run(["/usr/bin/security", "find-generic-password", "-s", service],
|
||||
capture_output=True, text=True).stdout
|
||||
@@ -71,7 +84,7 @@ class Switch:
|
||||
def lookup(macs):
|
||||
user, password = credentials()
|
||||
wanted = {m.lower(): m for m in macs}
|
||||
for host in SWITCHES:
|
||||
for host in config_switches():
|
||||
sw = Switch(host, user, password)
|
||||
try:
|
||||
model = [l.strip() for l in sw.run("show version").splitlines()
|
||||
|
||||
Reference in New Issue
Block a user