From 85aed218397292587560d77f485b3f551cee3a07 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Wed, 8 Jun 2022 15:01:00 -0400 Subject: [PATCH] rgw: return ENOENT for NO_SUCH_BUCKET in radosgw-admin bucket stats 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 --- src/rgw/rgw_admin.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 865da80d42252..43342c61988d0 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -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 [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); } } -- 2.39.5