-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Grain.item issue # 31427 removes duplicates in item returned lists #68289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 3006.x
Are you sure you want to change the base?
Conversation
@bertdawg76 Does this change only remove duplicates from roles or any grains that have a list value? |
if isinstance(ret[arg], list): | ||
unique_ret = list(dict.fromkeys(ret[arg])) | ||
ret[arg] = unique_ret |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not seem correct as a change for any generic grain that has a list value. It is conceivable to me that a grain could intentionally have a list that has items that have the same value--especially with a custom grain. Nothing I have read states that the value of a grain must be a set of unique values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. The referenced issue relates to the state module adding duplicates, not the execution one listing duplicates.
It should have already been fixed in #31471 though, is it still an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#31471 itself seems to indicate that duplicate items in the list is unexpected behavior. I can't think of a scenario where it would be desirable. That being said, this PR does not seem to fix that issue.
@dwoz it will remove duplicate values from any returned list, when the grain.item function is called |
What does this PR do?
when grains.item returns a list, this removes duplicate entries in the list
What issues does this PR fix or reference?
Fixes #31427
Previous Behavior
Duplicate in list were returned
New Behavior
Duplicates in list not returned
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes/No