mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
The three svc-db-* credential tests each hand-rolled the same transport
gate in their test.env.j2:
(lookup('config', application_id, 'services.tor.enabled') | bool
and lookup('config', application_id, 'services.<entity>.exposed') | bool)
Three copies of one predicate, each naming its own entity key, and each
free to drift from the onion mapping that actually decides reachability.
Extract it into plugins/lookup/tor_reachable.py, split the same way as
its sibling tor_ports.py: a plain is_reachable() for callers holding the
merged applications view, plus a thin LookupModule resolving it through
lookup('applications'). Because collect_exposed_ports() scans
services.values(), the entity name disappears from the templates
entirely -- they collapse to
TOR_ENABLED={{ lookup('tor_reachable', application_id) | lower }}
Rework the integration guard accordingly: it now asserts that every
svc-db-* template delegates to the shared lookup, and drives its
base/variant agreement table through the real is_reachable() instead of
re-implementing the predicate. Add unit coverage for the new lookup.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
9 lines
332 B
Bash
9 lines
332 B
Bash
DB_CONTAINER={{ POSTGRES_CONTAINER_ADDRESS }}
|
|
DB_NAME=postgres
|
|
DB_PASSWORD_B64={{ POSTGRES_PASSWORD | b64encode }}
|
|
DB_PORT={{ POSTGRES_PORT }}
|
|
DB_USER=postgres
|
|
ONION_HOST={{ lookup('config', 'svc-net-tor', 'services.tor.node') }}
|
|
TOR_ENABLED={{ lookup('tor_reachable', application_id) | lower }}
|
|
TOR_SOCKS={{ lookup('tor_socks') }}
|