summaryrefslogtreecommitdiffstats
path: root/debian/patches/bug1914584.patch
blob: 763a948f9f159d9a4ea2cd2b9e56a6d4e19b0369 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From a8c1aec073fc8364818027a26fa1ddb5d34c58af Mon Sep 17 00:00:00 2001
From: Matthew Vernon <mv3@sanger.ac.uk>
Date: Thu, 4 Feb 2021 11:41:14 +0000
Subject: [PATCH] rgw/radosgw-admin clarify error when email address already in
 use

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>
(cherry picked from commit 05318d6f71e45a42a46518a0ef17047dfab83990)
---
 src/rgw/rgw_user.cc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Index: ceph/src/rgw/rgw_user.cc
===================================================================
--- ceph.orig/src/rgw/rgw_user.cc
+++ ceph/src/rgw/rgw_user.cc
@@ -1970,7 +1970,14 @@ int RGWUser::remove(const DoutPrefixProv
 
   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;
   }