Skip to content

fix various bugs in list_present - #68369

Merged
dwoz merged 2 commits into
saltstack:3007.xfrom
Sxderp:pr-fix-list-preset-duplicates
Dec 12, 2025
Merged

dwoz merged 2 commits into
saltstack:3007.xfrom
Sxderp:pr-fix-list-preset-duplicates

Conversation

@Sxderp

@Sxderp Sxderp commented Oct 5, 2025 •

Copy link
Copy Markdown
Contributor

fixes #31427
fixes #39875 (previous solution was incomplete)

Trying to convert the list and sub-objects into a set caused various issues when checking for existance. Use a proper loop and in checks to provide a more correct behavior.

What does this PR do?

Fixes some bugs in the grains.list_present state. Some potential performance is lost (no measurements or benchmarks made) in favor of correctness. Out of the newly added test the previous implementation only "passed" the "test_list_present_multiple_calls_present_as_list" test. New implementation passes all the new tests.

What issues does this PR fix or reference?

fixes #31427
fixes #39875 (previous solution was incomplete)

Previous Behavior

  1. Duplicates could have been added when using the list_present state
  2. Crashes could have occurred when complex objects were used

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

No

Comment thread changelog/31427.fixed.md Resolved
Comment thread changelog/31427.fixed.md Resolved
Comment thread changelog/39875.fixed.md Resolved
@Sxderp

Sxderp commented Oct 21, 2025

Copy link
Copy Markdown
Contributor Author

rebase on 3007.x

fixes saltstack#31427
fixes saltstack#39875 (previous solution was incomplete)

Trying to convert the list and sub-objects into a set caused various
issues when checking for existance. Use a proper loop and `in` checks to
provide a more correct behavior.
@twangboy twangboy mentioned this pull request Dec 10, 2025
1 task

This branch was previously deployed

1 inactive deployment
ci — a33dc142 Deployed Dec 4, 2025 by twangboy
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.

Can't use grains.list_present with complex(dict) types salt.states.grains.list_present adds duplicates names

3 participants