fix(check_vars): tolerate inventories without an alert_server group - #80
Open
joseg20 wants to merge 1 commit into
Open
fix(check_vars): tolerate inventories without an alert_server group#80joseg20 wants to merge 1 commit into
joseg20 wants to merge 1 commit into
Conversation
On a combined deployment (traefik + mediamtx + platform + alert API on a
single VM, as deploy-combined.yml supports) the inventory has no
'alert_server' group. Referencing groups["alert_server"] then raises a
Jinja error instead of evaluating to false, so every engine deploy aborts
in check_vars -- and because the task sets no_log: true the message is
censored, which makes it hard to diagnose.
- guard both group lookups with groups.get(name, [])
- default('') the API-only vars (POSTGRES_*, prefix) so templating them on
hosts where they are undefined does not fail either
The Annotation-server task above already used groups.get(...), so this
just makes the API and single-host-assert tasks consistent with it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On a combined deployment (traefik + mediamtx + platform + alert API on a single VM — the topology
playbooks/deploy-combined.ymlsupports) the inventory has noalert_servergroup.check_varsreferences it directly:With the group absent, that expression raises a Jinja error instead of evaluating to false, so every engine deploy aborts in
check_vars. Because the task setsno_log: true, the output is censored:which makes it quite hard to diagnose (it cost us a while before spotting the missing group). The same pattern in
Verify that each group contains only one hostfails for the same reason.Fix
groups.get(name, [])default('')the API-only vars (POSTGRES_*,prefix) so templating them on hosts where they are undefined doesn't fail eitherThe Annotation server task right above already used
groups.get(...), so this only makes the API and single-host-assert tasks consistent with it.Testing
Verified on a combined deployment:
make deploy-one-engine SITE=<host>failed before the change and completes after it (ok=24 changed=4), with the API checks correctly skipped on engine hosts.