Skip to content
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

create_user throws RGWAdminException instead of UserExists #66

Closed
vergeev opened this issue Oct 11, 2023 · 3 comments
Closed

create_user throws RGWAdminException instead of UserExists #66

vergeev opened this issue Oct 11, 2023 · 3 comments

Comments

@vergeev
Copy link

vergeev commented Oct 11, 2023

Steps to reproduce:

from rgwadmin import RGWAdmin

rgw = RGWAdmin(access_key='XXX', secret_key='XXX', server='obj.example.com')
rgw.create_user(
    uid='liam',
    display_name='Liam Monahan',
    email='[email protected]',
    user_caps='usage=read, write; users=read',
    max_buckets=1000)
rgw.create_user(
    uid='liam',
    display_name='Liam Monahan',
    email='[email protected]',
    user_caps='usage=read, write; users=read',
    max_buckets=1000)

Expected result: the last line throws rgwadmin.exceptions.UserExists.

Actual result: the last line throws rgwadmin.exceptions.RGWAdminException with code="UserAlreadyExists".

Why I think this is happening: the docs say the error response is UserExists, but the rgw code actually produces UserAlreadyExists.

Solution I propose:

  1. Add UserAlreadyExists exception, replace with it UserExists here:
    for e in [AccessDenied, UserExists, InvalidAccessKey,
  2. Make UserExists an alias of UserAlreadyExists in order to maintain backwards compatibility.

Can I go ahead and open a pull request with a fix?

@dyarnell
Copy link
Contributor

Hi Pavel,

I think this is reasonable. The UserAlreadyExists goes back at least to the 12.x.x version of Ceph as the exception in the code. Please provide a pull request and I will be happy to merge.

vergeev pushed a commit to vergeev/rgwadmin that referenced this issue Oct 11, 2023
@vergeev
Copy link
Author

vergeev commented Oct 11, 2023

Here's the PR: #67. Please let me know if you want me to add anything.

dyarnell added a commit that referenced this issue Nov 1, 2023
@dyarnell
Copy link
Contributor

dyarnell commented Nov 1, 2023

This was released as part of https://github.com/UMIACS/rgwadmin/releases/tag/2.4.4 and is available on PyPI now.

@dyarnell dyarnell closed this as completed Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants