Skip to content

Fix yaml() Jinja filter returning NULL on Pillar containers#69225

Merged
dwoz merged 1 commit into
saltstack:3008.xfrom
dwoz:69218
May 26, 2026
Merged

Fix yaml() Jinja filter returning NULL on Pillar containers#69225
dwoz merged 1 commit into
saltstack:3008.xfrom
dwoz:69218

Conversation

@dwoz
Copy link
Copy Markdown
Contributor

@dwoz dwoz commented May 26, 2026

Pillar dicts and lists are wrapped in salt.utils.secret.MaskedDict / MaskedList (dict / list subclasses) so their repr can redact secrets. SafeOrderedDumper has no representer for those subclasses, so safe_dump fell through to the add_representer(None, represent_undefined) catch-all and emitted the scalar "NULL". Register MaskedDict / MaskedList with the Ordered / SafeOrdered / IndentedSafeOrdered dumpers (and the base PyYAML dumpers used by salt.utils.yaml.dump) so they serialize as their underlying dict / list.

Fixes #69218

Pillar dicts and lists are wrapped in salt.utils.secret.MaskedDict /
MaskedList (dict / list subclasses) so their repr can redact secrets.
SafeOrderedDumper has no representer for those subclasses, so safe_dump
fell through to the add_representer(None, represent_undefined) catch-all
and emitted the scalar "NULL". Register MaskedDict / MaskedList with the
Ordered / SafeOrdered / IndentedSafeOrdered dumpers (and the base PyYAML
dumpers used by salt.utils.yaml.dump) so they serialize as their
underlying dict / list.

Fixes saltstack#69218
@dwoz dwoz requested a review from a team as a code owner May 26, 2026 00:39
@dwoz dwoz added the test:full Run the full test suite label May 26, 2026
@dwoz dwoz merged commit 1223555 into saltstack:3008.x May 26, 2026
470 of 475 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant