]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
radosgw-admin: 'bi purge' doesn't require entrypoint 43591/head
authorCasey Bodley <cbodley@redhat.com>
Tue, 19 Oct 2021 17:09:15 +0000 (13:09 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 20 Oct 2021 15:21:39 +0000 (11:21 -0400)
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 <cbodley@redhat.com>
src/rgw/rgw_admin.cc

index e0c18efef6da63cac91520da2f1c46b3dc893bfd..6faa2107fbeef440f0a4f68d4e4e453e15032ead 100644 (file)
@@ -6843,12 +6843,13 @@ next:
 
     std::unique_ptr<rgw::sal::Bucket> 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;