]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/radosgw-admin clarify error when email address already in use 39293/head
authorMatthew Vernon <mv3@sanger.ac.uk>
Thu, 4 Feb 2021 11:41:14 +0000 (11:41 +0000)
committerMatthew Vernon <mv3@sanger.ac.uk>
Thu, 4 Feb 2021 11:47:18 +0000 (11:47 +0000)
The error message if you try and create an S3 user with an email
address that is already associated with another S3 account is very
confusing; this patch makes it much clearer

To reproduce:

radosgw-admin user create --uid=foo --display-name="Foo test" --email=bar@domain.invalid
radosgw-admin user create --uid=test --display-name="AN test" --email=bar@domain.invalid
could not create user: unable to parse parameters, user id mismatch, operation id: foo does not match: test

With this patch:

radosgw-admin user create --uid=test --display-name="AN test" --email=bar@domain.invalid
could not create user: unable to create user test because user id foo already exists with email bar@domain.invalid

Fixes: https://tracker.ceph.com/issues/49137
Fixes: https://tracker.ceph.com/issues/19411
Signed-off-by: Matthew Vernon <mv3@sanger.ac.uk>
src/rgw/rgw_user.cc

index 7cc2efe0990430fcf6fe684f58a9785c72e145d5..925a54d7a1c82382a9de8f6f3b9829d7bc8613f8 100644 (file)
@@ -2141,7 +2141,14 @@ int RGWUser::modify(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state
 
   ret = check_op(op_state, &subprocess_msg);
   if (ret < 0) {
-    set_err_msg(err_msg, "unable to parse parameters, " + subprocess_msg);
+    if (is_populated() && (user_id.compare(op_state.get_user_id()) != 0)) {
+      set_err_msg(err_msg, "unable to create user " + user_id.to_str()
+                 + " because user id " + op_state.get_user_id().to_str()
+                 + " already exists with email "
+                 + op_state.get_user_email());
+    } else {
+      set_err_msg(err_msg, "unable to parse parameters, " + subprocess_msg);
+    }
     return ret;
   }