Author SHA1 Message Date
moritz d74895bd01 fix(config): report a misspelt app key in an automatic config-set
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-09-14 13:31:06 +02:00
3 changed files with 29 additions and 2 deletions
+2
View File
@@ -289,6 +289,8 @@ CONFIG-SETS:
bbb: true
```
This is for bundles of per-app configuration that an operator turns on deliberately, a feature for instance. See [examples/config-sets.yml](./examples/config-sets.yml).
**By itself**, when it carries `apply-when` and every app named there is part of the instance:
```yaml
+2 -2
View File
@@ -183,7 +183,7 @@ def get_relevant_config_paths(root_path: Path, group_path: Path, exclude_paths:
"""
Collects every configuration file that can influence the result of this run: the 'alaka*.yml'
inheritance chain from the root path down to the group path, the instance configurations below
it, the config sets of the root path and the connection configuration shipped with alakazam.
it, and every config-set file in the root path.
Args:
root_path (Path): The alakazam root path
@@ -528,7 +528,7 @@ def merge_instance_configs(group_config: Dict[str, Any], instance_domain: str, i
instance_apps = {k: v for k, v in instance_config.items() if k not in NON_APP_KEYS}
automatic_app_configs, config_set_app_configs = get_config_set_app_configs(active_config_sets, config_sets, instance_apps)
# Warn about config-set entries that target apps not listed in the instance config.
for config_set_app in set(config_set_app_configs) - set(instance_apps):
for config_set_app in (set(automatic_app_configs) | set(config_set_app_configs)) - set(instance_apps):
logging.warning(
f"Config-set specifies config for '{config_set_app}' but '{config_set_app}' is not listed "
f"in the instance config for '{instance_domain}'. Skipping."
+25
View File
@@ -120,6 +120,31 @@ class TestIntegrationReachesTheMergedConfig:
assert "uncomment" not in self.merge(["authentik"])["authentik"]
class TestUnknownAppKeys:
"""A misspelt app key drops its configuration, which is only visible if it is reported."""
def test_a_typo_in_an_automatic_set_is_reported(self, caplog):
sets = {"integrate": {"apply-when": ["authentik", "nextcloud"],
"nextcoud": {"env": {"A": "b"}}}}
with caplog.at_level(logging.WARNING):
merge_instance_configs({}, "example.com", {"authentik": None, "nextcloud": None}, sets)
assert "'nextcoud' is not listed" in caplog.text
def test_a_typo_in_an_explicit_set_is_reported(self, caplog):
sets = {"bbb": {"nextcoud": {"env": {"A": "b"}}}}
with caplog.at_level(logging.WARNING):
merge_instance_configs({}, "example.com",
{"nextcloud": None, "CONFIG-SETS": {"bbb": True}}, sets)
assert "'nextcoud' is not listed" in caplog.text
def test_a_correct_app_key_is_not_reported(self, caplog):
sets = {"integrate": {"apply-when": ["authentik", "nextcloud"],
"nextcloud": {"env": {"A": "b"}}}}
with caplog.at_level(logging.WARNING):
merge_instance_configs({}, "example.com", {"authentik": None, "nextcloud": None}, sets)
assert caplog.text == ""
class TestPrecedence:
"""An integration is the lowest layer, as combine.yml was before it."""