]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: return ENOENT for NO_SUCH_BUCKET in radosgw-admin bucket stats 46581/head
authorMatt Benjamin <mbenjamin@redhat.com>
Wed, 8 Jun 2022 19:01:00 +0000 (15:01 -0400)
committerMatt Benjamin <mbenjamin@redhat.com>
Mon, 27 Jun 2022 11:54:08 +0000 (07:54 -0400)
This was a recent behavior change.

It might be tempting to normalize these, but I'm trying to avoid further
changes in result codes.

Fixes: https://tracker.ceph.com/issues/55975
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_admin.cc

index 865da80d42252782a136dea40f111abcf5ffc8c7..43342c61988d080ce41100b98daf3af193fc56b3 100644 (file)
@@ -108,6 +108,18 @@ static const DoutPrefixProvider* dpp() {
     } \
   } while (0)
 
+static inline int posix_errortrans(int r)
+{
+  switch(r) {
+  case ERR_NO_SUCH_BUCKET:
+    r = ENOENT;
+    break;
+  default:
+    break;
+  }
+  return r;
+}
+
 void usage()
 {
   cout << "usage: radosgw-admin <cmd> [options...]" << std::endl;
@@ -6967,7 +6979,7 @@ int main(int argc, const char **argv)
     int r = RGWBucketAdminOp::info(store, bucket_op, stream_flusher, null_yield, dpp());
     if (r < 0) {
       cerr << "failure: " << cpp_strerror(-r) << ": " << err << std::endl;
-      return -r;
+      return posix_errortrans(-r);
     }
   }