From 269e9b9d3c81aa8a9831f9d60429bb913a63eff0 Mon Sep 17 00:00:00 2001 From: Matthew Oliver Date: Fri, 10 Jan 2020 03:17:11 +0000 Subject: [PATCH] rgw: make radosgw-admin user create and modify distinct 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 Fixes: https://tracker.ceph.com/issues/38619 --- src/rgw/rgw_user.cc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/rgw/rgw_user.cc b/src/rgw/rgw_user.cc index 48b47ed1e9ca7..171f44cec9f00 100644 --- a/src/rgw/rgw_user.cc +++ b/src/rgw/rgw_user.cc @@ -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"); -- 2.39.5