Skip to content

Commit

Permalink
rgw: make radosgw-admin user rm idempotent
Browse files Browse the repository at this point in the history
Fixes: ceph#5378
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
  • Loading branch information
oritwas committed Sep 14, 2015
1 parent 27d1e4d commit 2f663d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/rgw/rgw_admin.cc
Expand Up @@ -1764,7 +1764,9 @@ int main(int argc, char **argv)
break;
case OPT_USER_RM:
ret = user.remove(user_op, &err_msg);
if (ret < 0) {
if (ret == -ENOENT) {
cerr << err_msg << std::endl;
} else if (ret < 0) {
cerr << "could not remove user: " << err_msg << std::endl;
return -ret;
}
Expand Down
4 changes: 2 additions & 2 deletions src/rgw/rgw_user.cc
Expand Up @@ -466,7 +466,7 @@ int rgw_delete_user(RGWRados *store, RGWUserInfo& info, RGWObjVersionTracker& ob
rgw_obj uid_obj(store->zone.user_uid_pool, info.user_id);
ldout(store->ctx(), 10) << "removing user index: " << info.user_id << dendl;
ret = store->meta_mgr->remove_entry(user_meta_handler, info.user_id, &objv_tracker);
if (ret < 0 && ret != -ENOENT) {
if (ret < 0 && ret != -ENOENT && ret != -ECANCELED) {
ldout(store->ctx(), 0) << "ERROR: could not remove " << info.user_id << ":" << uid_obj << ", should be fixed (err=" << ret << ")" << dendl;
return ret;
}
Expand Down Expand Up @@ -1903,7 +1903,7 @@ int RGWUser::execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg)

if (!op_state.has_existing_user()) {
set_err_msg(err_msg, "user does not exist");
return -EINVAL;
return -ENOENT;
}

bool done;
Expand Down

0 comments on commit 2f663d9

Please sign in to comment.