]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: make radosgw-admin user create and modify distinct 31901/head
authorMatthew Oliver <moliver@suse.com>
Fri, 10 Jan 2020 03:17:11 +0000 (03:17 +0000)
committerMatthew Oliver <moliver@suse.com>
Mon, 17 Feb 2020 04:07:40 +0000 (04:07 +0000)
Currently if you run 'radosgw-admin user create ..' when the user
already exists and you happen to specify, at least,  '--uid' and
'--display-name' that match the existing user, radowgw-admin will
actaully go modify the existing user.

This behaviour is a little confusing, hence the bug this patch is
fixing. This patch instead simplifies the tool to make
'create' create and 'modify' modify.
Meaning when you go 'create' a user that already exists, you'll get an
error, as expected. If you want to modify a user, you actually have to
use 'modify'.

For exapmle, now:

  $ radosgw-admin user create --uid="test-user"  --display-name="test user"
  could not create user: unable to create user, user: test-user exists

Signed-off-by: Matthew Oliver <moliver@suse.com>
Fixes: https://tracker.ceph.com/issues/38619
src/rgw/rgw_user.cc

index 48b47ed1e9ca705e5b5ec29f1542db6c7f9d453f..171f44cec9f0007adb70efb3a117e273deeb3b68 100644 (file)
@@ -1703,13 +1703,6 @@ int RGWUser::execute_add(RGWUserAdminOpState& op_state, std::string *err_msg)
 
   // fail if the user exists already
   if (op_state.has_existing_user()) {
-    if (!op_state.exclusive &&
-        (user_email.empty() ||
-        boost::iequals(user_email, old_info.user_email)) &&
-        old_info.display_name == display_name) {
-      return execute_modify(op_state, err_msg);
-    }
-
     if (op_state.found_by_email) {
       set_err_msg(err_msg, "email: " + user_email +
                  " is the email address an existing user");