mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-12-04 08:48:45 +00:00
fix(svc-prx-openresty): resolve OpenResty's own address in handlers notified from forced roles
web-app-matrix (ansible flavor) and web-app-bigbluebutton set compose_mode_force: compose in their role vars, and those vars stay in scope when their front-proxy includes notify the OpenResty handlers. In swarm the handlers' container_address lookup then returned the bare compose name, the validate retried for about 35 s against a container that does not exist and ended ok, and the reload was skipped: 3 of 52 reloads in the WordPress#0 job of fork run 41926377524 (both matrix .onion vhosts), so changed vhosts stayed unserved. The validate, reload and restart handler tasks now clear compose_mode_force at task level (task vars outrank the inherited role vars), as the engine, rdbms and objstore entry points already do, and so do the svc-db-openldap handlers, which the new lint also covers. The proxy_pass lookup applies a caller's override only when the term names the scope's own application_id, because the /logout location rendered inside matrix and BBB vhosts pointed at 127.0.0.1 in swarm. A real ansible-playbook integration test proves both modes and fails without the fix; the new lint keeps every handler lookup of a fixed role clearing the override. 🎯 Fix: 90 % 💥 Break: 4 % 🌱 Efficiency: – ⚡ Speed: – 🛡️ Security: ~100 % 🏆 Score: 86 🚦 Gate: ✅ 90/5, efficiency and speed <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
56bcbb6d13
commit
7e5da9422c
8 files changed
+493
-1
No files matched your search
@@ -29,6 +29,13 @@ def _apps() -> dict[str, Any]:
|
||||
},
|
||||
},
|
||||
},
|
||||
"web-svc-logout": {
|
||||
"services": {
|
||||
"logout": {
|
||||
"ports": {"local": {"http": 8048}, "internal": {"http": 8000}},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -194,6 +201,35 @@ class TestProxyPassLookup(unittest.TestCase):
|
||||
)
|
||||
self.assertEqual(out[0], "proxy_pass http://127.0.0.1:8021/;")
|
||||
|
||||
def test_a_forced_scope_leaves_a_foreign_app_at_the_cluster_mode(self):
|
||||
out = _run(
|
||||
["web-svc-logout", "logout", "http"],
|
||||
variables={
|
||||
"DEPLOYMENT_MODE": "swarm",
|
||||
"compose_mode_force": "compose",
|
||||
"application_id": "web-app-baserow",
|
||||
},
|
||||
tail="/logout",
|
||||
)
|
||||
self.assertEqual(
|
||||
out[0],
|
||||
'set $proxy_pass_upstream "logout:8000";\n'
|
||||
" proxy_pass http://$proxy_pass_upstream/logout;",
|
||||
)
|
||||
|
||||
def test_a_forced_scope_still_forces_its_own_app(self):
|
||||
out = _run(
|
||||
["web-app-baserow", "application", "http"],
|
||||
variables={
|
||||
"DEPLOYMENT_MODE": "swarm",
|
||||
"compose_mode_force": "compose",
|
||||
"application_id": "web-app-baserow",
|
||||
},
|
||||
tail="request",
|
||||
location="/",
|
||||
)
|
||||
self.assertEqual(out[0], "proxy_pass http://127.0.0.1:8017/;")
|
||||
|
||||
def test_resolution_error_becomes_ansible_error(self):
|
||||
lm = LookupModule()
|
||||
lm._templar = _Templar({"DEPLOYMENT_MODE": "swarm"})
|
||||
|
||||
Reference in new issue
Block a user