cmds.secrets.FilesContext: Re-shuffle attrs precedence

_compile_one_template_file() re-parses the template's own conf line and,
when present, discards the attrs that compile_template_file() merged from
the command-line defaults, the template, the .jw-secret-file, and the
.jw-secret. The merge already orders the sources so that later non-empty
fields override earlier ones; discarding it inverts the order and lets the
template's line override the one the operator placed in the .jw-secret.

Strip the template's conf line from the content and apply the merged attrs
instead, so the .jw-secret conf line takes the last word again, as the
compiler did before the rewrite. The integration test gains a target whose
template and secret both carry a conf line.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.4.0
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-10-24 07:22:47 +02:00
commit ea45cb1fed
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -115,15 +115,16 @@ class FilesContext:
result = await self.ctx.get(src)
new_content = result.stdout_str
attrs = self._parse_attributes(new_content)
if attrs is None:
attrs = default_attrs
else:
if self._parse_attributes(new_content) is not None:
# -- A conf line is the attribute spec of the output
# file, not part of its content
# file, not part of its content. The merged attrs
# contain this line, and a conf line in the secret
# takes precedence over it.
lines = new_content.splitlines(keepends = True)
new_content = ''.join(lines[1:])
attrs = default_attrs
if attrs is not None:
if attrs.owner is not None:
owner = attrs.owner