From: Gaurav Kumar Garg Date: Wed, 6 Jul 2016 16:56:27 +0000 (+0200) Subject: rgw: better error message when user has no bucket created yet X-Git-Tag: ses5-milestone5~323^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b9a2048c6646463e1b7b299dae36fbb4f887fc00;p=ceph.git rgw: better error message when user has no bucket created yet Currently when there is no bucket in the cluster and user execute "$radosgw-admin user stats --uid=testid" command then rgw admin not throwing meaningful error message. With this fix it will show proper meaningful error message. Fixes: http://tracker.ceph.com/issues/16444 Reported-by: Abhishek Lekshmanan Signed-off-by: Gaurav Kumar Garg --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index fe474cef0a39..6fcc30dd74e0 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -4817,7 +4817,11 @@ next: string user_str = user_id.to_str(); int ret = store->cls_user_get_header(user_str, &header); if (ret < 0) { - cerr << "ERROR: can't read user header: " << cpp_strerror(-ret) << std::endl; + if (ret == -ENOENT) { /* in case of ENOENT */ + cerr << "User has not been initialized or user does not exist" << std::endl; + } else { + cerr << "ERROR: can't read user: " << cpp_strerror(ret) << std::endl; + } return -ret; }