From 94db3409178ad6986609fd9c4dd9b152a4722f7c Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Tue, 19 Oct 2021 13:09:15 -0400 Subject: [PATCH] radosgw-admin: 'bi purge' doesn't require entrypoint we may get -ENOENT looking up cur_bucket here. we look up cur_bucket so we can avoid purging the 'current' bucket instance. but if that entrypoint doesn't exist, there is no current instance and that shouldn't prevent us from purging Fixes: https://tracker.ceph.com/issues/52976 Signed-off-by: Casey Bodley --- src/rgw/rgw_admin.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index e0c18efef6da..6faa2107fbee 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -6843,12 +6843,13 @@ next: std::unique_ptr cur_bucket; ret = init_bucket(user.get(), tenant, bucket_name, string(), &cur_bucket); - if (ret < 0) { + if (ret == -ENOENT) { + // no bucket entrypoint + } else if (ret < 0) { cerr << "ERROR: could not init current bucket info for bucket_name=" << bucket_name << ": " << cpp_strerror(-ret) << std::endl; return -ret; - } - - if (cur_bucket->get_bucket_id() == bucket->get_bucket_id() && !yes_i_really_mean_it) { + } else if (cur_bucket->get_bucket_id() == bucket->get_bucket_id() && + !yes_i_really_mean_it) { cerr << "specified bucket instance points to a current bucket instance" << std::endl; cerr << "do you really mean it? (requires --yes-i-really-mean-it)" << std::endl; return EINVAL; -- 2.47.3