From: Casey Bodley Date: Tue, 19 Oct 2021 17:09:15 +0000 (-0400) Subject: radosgw-admin: 'bi purge' doesn't require entrypoint X-Git-Tag: v17.1.0~522^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=94db3409178ad6986609fd9c4dd9b152a4722f7c;p=ceph.git 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 --- 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;