Skip to content

Conversation

@Sxderp
Copy link
Contributor

@Sxderp Sxderp commented Oct 5, 2025

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

@Sxderp
Copy link
Contributor Author

Sxderp commented Oct 21, 2025

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.
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.

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

2 participants