Skip to content

Conversation

@dwoz
Copy link
Contributor

@dwoz dwoz commented Dec 14, 2025

When merging pillar data, None values were overwriting existing non-empty dictionaries. This fix adds a _filter_none_overwrites function that filters out None values during pillar merging to preserve existing data.

  • Added _filter_none_overwrites function to Pillar.render_pillar
  • Added test case to test_pillar.py to verify the fix

Fixes #33437

…llar data

When merging pillar data, if one pillar file is empty (e.g., due to
conditional rendering that produces no output), None values were
overwriting existing non-empty dictionaries.

This fix adds a _filter_none_overwrites function that recursively
removes None values that would overwrite existing non-empty dicts
during the pillar merge process.

- Added _filter_none_overwrites function to salt/pillar/__init__.py
- Applied filter before merging pillar state
- Added test case to test_pillar.py to verify the fix
Copy link
Contributor

@twangboy twangboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we still using OrderedDict on 3006.x? Maybe it's only removed on master.
Also needs a changelog

# causes an UnboundLocalError. This should be investigated and fixed, but until
# then, leave the import directly below this comment intact.
from salt.utils.dictupdate import merge
from salt.utils.odict import OrderedDict
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not using this anymore, right?

import salt.loader
import salt.pillar
import salt.utils.cache
from salt.utils.odict import OrderedDict
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:coverage test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merging pillars when one is empty gives empty result

2 participants