-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[3006.x] Fix user.present state when group is unset #64530
Conversation
@@ -189,6 +189,8 @@ def test_present_uid_gid_change(): | |||
"user.chgid": Mock(), | |||
"file.group_to_gid": mock_group_to_gid, | |||
"file.gid_to_group": mock_gid_to_group, | |||
"group.info": MagicMock(return_value=after), |
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.
@nicholasmhughes I'm cautious about this change to this test, since group.info
and user.chgroups
was not called previously. But I think with my fix it should be getting called to ensure we are changing the user foo's group assignment to othergroup
. Wanted to get your thoughts since you last changed this test.
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.
seems reasonable to me. 👍
@@ -189,6 +189,8 @@ def test_present_uid_gid_change(): | |||
"user.chgid": Mock(), | |||
"file.group_to_gid": mock_group_to_gid, | |||
"file.gid_to_group": mock_gid_to_group, | |||
"group.info": MagicMock(return_value=after), |
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.
seems reasonable to me. 👍
What does this PR do?
If the
group
arg is unset when usinguser.present
it should not edit the groups of the user. This is documented behavior. This was changed in this PR #62503 to ensure optional_groups are fixed. This PR ensures we keep the optional_groups working and ensure the documented behavior whengroup
args is unset.What issues does this PR fix or reference?
Fixes: #64211
Previous Behavior
When
group
was unset when using user.present it would edit the group list if it didn't mirror what groups where currently in the system, resulting in salt returning a changes directory each time.New Behavior
When
group is unset when using
user.present` it does not edit the groups the user is a part of.