mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 14:30:52 +00:00
fix(domains): read an application's domains where the cache puts them
meta/domains.yml lands on the top-level `domains` key of the merged application, yet three readers still looked under `server.domains`, which no role fills any more: - current_play_redirect_domains built every mapping from an empty config, so each app redirected to itself and was dropped. Neither `domains.aliases` nor AUTO_BUILD_ALIASES produced a single redirect, and echoserver's update check listed nextcloud.infinito.nexus and the other entity domains as dropped by the upgrade. - csp_skip_domains never found the canonical of a disabled service. - the logout filter's fallback returned no domains. The unit tests fed the old layout and passed regardless. They now use the merged one, and a new test builds the redirect from keycloak's real role defaults. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
08680e933d
commit
bfdf88fae0
7 files changed
+36
-34
No files matched your search
@@ -4,6 +4,7 @@ import unittest
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from plugins.lookup.current_play_redirect_domains import LookupModule
|
||||
from utils.cache.applications import get_application_defaults
|
||||
|
||||
|
||||
class _DummyTemplar:
|
||||
@@ -107,11 +108,9 @@ class CurrentPlayRedirectDomainsLookupTests(unittest.TestCase):
|
||||
lm = self._make_lookup()
|
||||
apps = {
|
||||
"web-app-foo": {
|
||||
"server": {
|
||||
"domains": {
|
||||
"canonical": ["foo.example.com"],
|
||||
"aliases": ["alt-foo.example.com"],
|
||||
}
|
||||
"domains": {
|
||||
"canonical": ["foo.example.com"],
|
||||
"aliases": ["alt-foo.example.com"],
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,15 +125,24 @@ class CurrentPlayRedirectDomainsLookupTests(unittest.TestCase):
|
||||
result,
|
||||
)
|
||||
|
||||
def test_auto_alias_built_from_the_merged_role_domains(self):
|
||||
lm = self._make_lookup()
|
||||
apps = {"web-app-keycloak": get_application_defaults()["web-app-keycloak"]}
|
||||
variables = {"DOMAIN_PRIMARY": "example.org", "AUTO_BUILD_ALIASES": True}
|
||||
with self._patch_lookups(deployed=[], current_play_apps=apps):
|
||||
result = lm.run(terms=[], variables=variables)[0]
|
||||
self.assertIn(
|
||||
{"source": "keycloak.example.org", "target": "auth.example.org"},
|
||||
result,
|
||||
)
|
||||
|
||||
def test_user_mapping_overrides_per_app_mapping_on_same_source(self):
|
||||
lm = self._make_lookup()
|
||||
apps = {
|
||||
"web-app-foo": {
|
||||
"server": {
|
||||
"domains": {
|
||||
"canonical": ["foo.example.com"],
|
||||
"aliases": ["alt.example.com"],
|
||||
}
|
||||
"domains": {
|
||||
"canonical": ["foo.example.com"],
|
||||
"aliases": ["alt.example.com"],
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,11 +166,9 @@ class CurrentPlayRedirectDomainsLookupTests(unittest.TestCase):
|
||||
lm = self._make_lookup()
|
||||
apps = {
|
||||
"web-app-foo": {
|
||||
"server": {
|
||||
"domains": {
|
||||
"canonical": ["foo.example.com"],
|
||||
"aliases": ["alt-foo.example.com"],
|
||||
}
|
||||
"domains": {
|
||||
"canonical": ["foo.example.com"],
|
||||
"aliases": ["alt-foo.example.com"],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user