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
// 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");