Skip to content

rgw/iam: DeleteUser also checks for group memberships - #72501

Open
cbodley wants to merge 2 commits into
ceph:mainfrom
cbodley:wip-81353
Open

cbodley wants to merge 2 commits into
ceph:mainfrom
cbodley:wip-81353

Conversation

@cbodley

@cbodley cbodley commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

from https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteUser.html,

Before attempting to delete a user, remove the following items:

  • Group memberships (RemoveUserFromGroup)

add a check for group memberships to RGWDeleteUser_IAM::check_empty() to return the same 409 DeleteConflict error as aws

Fixes: https://tracker.ceph.com/issues/81353

Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@cbodley
cbodley requested a review from a team as a code owner October 8, 2026 15:20
@cbodley cbodley added the bug-fix label Oct 8, 2026
@cbodley
cbodley requested a review from mmgaggle October 8, 2026 20:55

@BBoozmen BBoozmen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this one makes the case for #72511 (comment) stronger. This dangling old renames will block this deletion I believe.

from https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteUser.html,
> Before attempting to delete a user, remove the following items:
> * Group memberships (RemoveUserFromGroup)

add a check for group memberships to `RGWDeleteUser_IAM::check_empty()`
to return the same 409 DeleteConflict error as aws

Fixes: https://tracker.ceph.com/issues/81353

Signed-off-by: Casey Bodley <[email protected]>
@anrao19

anrao19 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-anrao9-testing-2026-11-13-0841-main.

@ivancich

Copy link
Copy Markdown
Member

@cbodley The QA run had failures surrounding test_account_group_update getting a Failed: DID NOT RAISE DeleteConflictException.

Here are the runs:
https://pulpito.ceph.com/anuchaithra-2026-11-13_16:50:36-rgw-wip-anrao9-testing-2026-11-13-1450-main-distro-default-trial/

=================================== FAILURES ===================================
2026-11-14T14:06:04.013 INFO:teuthology.orchestra.run.trial082.stdout:__________________________ test_account_group_update ___________________________
2026-11-14T14:06:04.013 INFO:teuthology.orchestra.run.trial082.stdout:
2026-11-14T14:06:04.013 INFO:teuthology.orchestra.run.trial082.stdout:iam_root = <botocore.client.IAM object at 0x70a2bdb714f0>
2026-11-14T14:06:04.013 INFO:teuthology.orchestra.run.trial082.stdout:
2026-11-14T14:06:04.014 INFO:teuthology.orchestra.run.trial082.stdout: @pytest.mark.group
2026-11-14T14:06:04.014 INFO:teuthology.orchestra.run.trial082.stdout: @pytest.mark.iam_account
2026-11-14T14:06:04.014 INFO:teuthology.orchestra.run.trial082.stdout: def test_account_group_update(iam_root):
2026-11-14T14:06:04.014 INFO:teuthology.orchestra.run.trial082.stdout: path = get_iam_path_prefix()
2026-11-14T14:06:04.014 INFO:teuthology.orchestra.run.trial082.stdout: name = make_iam_name('G1')
2026-11-14T14:06:04.014 INFO:teuthology.orchestra.run.trial082.stdout: response = iam_root.create_group(GroupName=name, Path=path)
2026-11-14T14:06:04.014 INFO:teuthology.orchestra.run.trial082.stdout: group_id = response['Group']['GroupId']
2026-11-14T14:06:04.014 INFO:teuthology.orchestra.run.trial082.stdout:
2026-11-14T14:06:04.014 INFO:teuthology.orchestra.run.trial082.stdout: username = make_iam_name('U1')
2026-11-14T14:06:04.014 INFO:teuthology.orchestra.run.trial082.stdout: iam_root.create_user(UserName=username, Path=path)
2026-11-14T14:06:04.015 INFO:teuthology.orchestra.run.trial082.stdout:
2026-11-14T14:06:04.015 INFO:teuthology.orchestra.run.trial082.stdout: iam_root.add_user_to_group(GroupName=name, UserName=username)
2026-11-14T14:06:04.015 INFO:teuthology.orchestra.run.trial082.stdout:
2026-11-14T14:06:04.015 INFO:teuthology.orchestra.run.trial082.stdout: response = iam_root.list_groups_for_user(UserName=username)
2026-11-14T14:06:04.015 INFO:teuthology.orchestra.run.trial082.stdout: groups = response['Groups']
2026-11-14T14:06:04.015 INFO:teuthology.orchestra.run.trial082.stdout: assert len(groups) == 1
2026-11-14T14:06:04.015 INFO:teuthology.orchestra.run.trial082.stdout: assert path == groups[0]['Path']
2026-11-14T14:06:04.015 INFO:teuthology.orchestra.run.trial082.stdout: assert name == groups[0]['GroupName']
2026-11-14T14:06:04.015 INFO:teuthology.orchestra.run.trial082.stdout: assert group_id == groups[0]['GroupId']
2026-11-14T14:06:04.015 INFO:teuthology.orchestra.run.trial082.stdout:
2026-11-14T14:06:04.015 INFO:teuthology.orchestra.run.trial082.stdout: new_path = path + 'new/'
2026-11-14T14:06:04.016 INFO:teuthology.orchestra.run.trial082.stdout: new_name = make_iam_name('NG1')
2026-11-14T14:06:04.016 INFO:teuthology.orchestra.run.trial082.stdout: iam_root.update_group(GroupName=name, NewPath=new_path, NewGroupName=new_name)
2026-11-14T14:06:04.016 INFO:teuthology.orchestra.run.trial082.stdout:
2026-11-14T14:06:04.016 INFO:teuthology.orchestra.run.trial082.stdout: response = iam_root.get_group(GroupName=new_name)
2026-11-14T14:06:04.016 INFO:teuthology.orchestra.run.trial082.stdout: group = response['Group']
2026-11-14T14:06:04.016 INFO:teuthology.orchestra.run.trial082.stdout: assert new_path == group['Path']
2026-11-14T14:06:04.016 INFO:teuthology.orchestra.run.trial082.stdout: assert new_name == group['GroupName']
2026-11-14T14:06:04.016 INFO:teuthology.orchestra.run.trial082.stdout: assert group_id == group['GroupId']
2026-11-14T14:06:04.016 INFO:teuthology.orchestra.run.trial082.stdout: arn = group['Arn']
2026-11-14T14:06:04.016 INFO:teuthology.orchestra.run.trial082.stdout: assert arn.startswith('arn:aws:iam:')
2026-11-14T14:06:04.016 INFO:teuthology.orchestra.run.trial082.stdout: assert arn.endswith(f':group{new_path}{new_name}')
2026-11-14T14:06:04.017 INFO:teuthology.orchestra.run.trial082.stdout: users = response['Users']
2026-11-14T14:06:04.017 INFO:teuthology.orchestra.run.trial082.stdout: assert len(users) == 1
2026-11-14T14:06:04.017 INFO:teuthology.orchestra.run.trial082.stdout: assert username == users[0]['UserName']
2026-11-14T14:06:04.017 INFO:teuthology.orchestra.run.trial082.stdout:
2026-11-14T14:06:04.017 INFO:teuthology.orchestra.run.trial082.stdout: response = iam_root.list_groups_for_user(UserName=username)
2026-11-14T14:06:04.017 INFO:teuthology.orchestra.run.trial082.stdout: groups = response['Groups']
2026-11-14T14:06:04.017 INFO:teuthology.orchestra.run.trial082.stdout: assert len(groups) == 1
2026-11-14T14:06:04.017 INFO:teuthology.orchestra.run.trial082.stdout: assert new_path == groups[0]['Path']
2026-11-14T14:06:04.017 INFO:teuthology.orchestra.run.trial082.stdout: assert new_name == groups[0]['GroupName']
2026-11-14T14:06:04.017 INFO:teuthology.orchestra.run.trial082.stdout: assert group_id == groups[0]['GroupId']
2026-11-14T14:06:04.017 INFO:teuthology.orchestra.run.trial082.stdout:
2026-11-14T14:06:04.018 INFO:teuthology.orchestra.run.trial082.stdout: # DeleteUser fails while it still has a group membership
2026-11-14T14:06:04.018 INFO:teuthology.orchestra.run.trial082.stdout:> with pytest.raises(iam_root.exceptions.DeleteConflictException):
2026-11-14T14:06:04.018 INFO:teuthology.orchestra.run.trial082.stdout:E Failed: DID NOT RAISE DeleteConflictException
2026-11-14T14:06:04.018 INFO:teuthology.orchestra.run.trial082.stdout:
2026-11-14T14:06:04.018 INFO:teuthology.orchestra.run.trial082.stdout:s3tests/functional/test_iam.py:1585: Failed
2026-11-14T14:06:04.018 INFO:teuthology.orchestra.run.trial082.stdout:---------------------------- Captured stdout setup -----------------------------
2026-11-14T14:06:04.018 INFO:teuthology.orchestra.run.trial082.stdout:Done with cleanup of buckets in tests.
2026-11-14T14:06:04.018 INFO:teuthology.orchestra.run.trial082.stdout:Done with cleanup of buckets in tests.
2026-11-14T14:06:04.018 INFO:teuthology.orchestra.run.trial082.stdout:Done with cleanup of buckets in tests.
2026-11-14T14:06:04.018 INFO:teuthology.orchestra.run.trial082.stdout:--------------------------- Captured stdout teardown ---------------------------
2026-11-14T14:06:04.018 INFO:teuthology.orchestra.run.trial082.stdout:Done with cleanup of buckets in tests.
2026-11-14T14:06:04.019 INFO:teuthology.orchestra.run.trial082.stdout:Done with cleanup of buckets in tests.
2026-11-14T14:06:04.019 INFO:teuthology.orchestra.run.trial082.stdout:Done with cleanup of buckets in tests.
2026-11-14T14:06:04.019 INFO:teuthology.orchestra.run.trial082.stdout:=========================== short test summary info ============================
2026-11-14T14:06:04.019 INFO:teuthology.orchestra.run.trial082.stdout:FAILED s3tests/functional/test_iam.py::test_account_group_update - Failed: DI...
2026-11-14T14:06:04.019 INFO:teuthology.orchestra.run.trial082.stdout:==== 1 failed, 1191 passed, 13 skipped, 593 deselected in 465.70s (0:07:45) ====

@anrao19

anrao19 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

This PR has been removed from wip-anrao9-testing-2026-11-13-1450-main.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants