Skip to content

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

Open
dwoz wants to merge 1 commit into
saltstack:3008.xfrom
dwoz:69218
Open

Fix yaml() Jinja filter returning NULL on Pillar containers#69225
dwoz wants to merge 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
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