Repository navigation
Conversation
cephclient_keyring named the configuration directory as a template
inside a string literal of the outer template:
lookup('file', '{{ configuration_directory }}/environments/...')
ansible-core 2.19 and later warn on every use of it:
Jinja constant strings should not contain embedded templates. This
feature will be disabled by default in ansible-core 2.23.
On a deploy of OSISM 11.0.3 with an osism-ansible image on ansible-core
2.20.10 the warning came from the osism.services.cephclient tasks, with
its origin at all/099-infrastructure.yml:6.
Build the path by concatenation instead:
lookup('file', configuration_directory ~ '/environments/...')
A playbook defining both forms against a test keyring file gets
identical content, trailing newline included, on ansible-core 2.18.18,
2.19.15 and 2.20.10, and the new form causes no warning. With the
keyring file missing, both forms fail the same way on 2.18.18 and
2.20.10: default('', true) does not catch a failing file lookup, and
this change leaves that as it is.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Roger Luethi <luethi@osism.tech>
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.
cephclient_keyringnames the configuration directory as a template inside a string literal of the outer template:lookup('file', '{{ configuration_directory }}/environments/...')ansible-core 2.19 and later warn on every use of it:
This builds the path by concatenation instead:
lookup('file', configuration_directory ~ '/environments/...').Testing
A playbook defining both forms, run in the osism-ansible
0.20261111.0image and in images derived from it that only replace ansible-core:default('', true)does not catch a failingfilelookup with either form; this change leaves that as it is.The warning was seen on an OSISM 11.0.3 deploy with an osism-ansible image on ansible-core 2.20.10, in the
osism.services.cephclienttasks. Released osism-ansible images run ansible-core 2.18, which does not warn.Other occurrences
Scanning the YAML and Jinja sources of the OSISM Ansible repositories (defaults, generics, cfg-cookiecutter, ansible-playbooks, and the collections and container images that carry plays) with Jinja's lexer for string literals that contain a template found this as the only case. The one other hit,
{{ '{{.Image}}' }}in the manager role'scheck-service-manager-versions.sh.j2, is meant to emit a literal Docker format string. On the 2.20 deploy, this variable was the only source of the warning.🤖 Generated with Claude Code