]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: better error message when user has no bucket created yet 10162/head
authorGaurav Kumar Garg <garg.gaurav52@gmail.com>
Wed, 6 Jul 2016 16:56:27 +0000 (18:56 +0200)
committerGaurav Kumar Garg <garg.gaurav52@gmail.com>
Fri, 22 Jul 2016 10:14:23 +0000 (12:14 +0200)
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 <abhishek@suse.com>
Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
src/rgw/rgw_admin.cc

index fe474cef0a39c4d3e8f19f7080ff12605a9941b0..6fcc30dd74e07edba0bb1f4b2ad6f3c2a2dff129 100644 (file)
@@ -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;
     }