switch: fix the unquoted python string that broke status with no --name

`cmd_status` has two paths. The `--name` path filters on an exact tag and
works. The no-name path — the "show me every switch on this box" survey,
which is how an orphan switch under a different name would be found —
built its python with shell quote-juggling and never closed the string
literal, so it died with a SyntaxError every time.

It failed loudly (rc=1, a traceback) rather than reporting "no rules", so
it never lied about the state. But it also meant the survey path had
never once run, which is the more useful lesson: every branch of a safety
tool needs exercising, not just the branch the happy path takes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-08-11 16:16:10 +00:00
parent ca63095786
commit 096d1c882f
+1 -1
View File
@@ -129,7 +129,7 @@ print(json.dumps([r for r in json.load(sys.stdin) if r["comment"] in tags]))
all="$(rules_json | python3 -c '
import json,sys
print(json.dumps([r for r in json.load(sys.stdin)
if (r["comment"] or "").startswith("'"$TAG_PREFIX"':')]))')"
if (r["comment"] or "").startswith("'"$TAG_PREFIX"':")]))')"
fi
python3 - "$all" "$tag" <<'PY'