]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
radosgw-admin: make SiteConfig available to commands
authorCasey Bodley <cbodley@redhat.com>
Sun, 4 Feb 2024 16:37:57 +0000 (11:37 -0500)
committerCasey Bodley <cbodley@redhat.com>
Wed, 10 Apr 2024 13:18:06 +0000 (09:18 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 0f333f1cc5a265015d4d436e1275ffadc2d0d8d4)

src/rgw/rgw_admin.cc

index eae3736bb7dc2f2304935242161bc41d6b9da730..886e4bc005bf07e86642f4562a8e699858a6d6d5 100644 (file)
@@ -4093,6 +4093,7 @@ int main(int argc, const char **argv)
   common_init_finish(g_ceph_context);
 
   std::unique_ptr<rgw::sal::ConfigStore> cfgstore;
+  std::unique_ptr<rgw::SiteConfig> site;
 
   if (args.empty()) {
     usage();
@@ -4279,8 +4280,6 @@ int main(int argc, const char **argv)
       return EIO;
     }
 
-    std::unique_ptr<rgw::SiteConfig> site;
-
     if (raw_storage_op) {
       site = rgw::SiteConfig::make_fake();
       driver = DriverManager::get_raw_storage(dpp(), g_ceph_context,
@@ -10656,12 +10655,6 @@ next:
   }
 
   if (opt_cmd == OPT::PUBSUB_TOPIC_LIST) {
-    auto site = std::make_unique<rgw::SiteConfig>();
-    ret = site->load(dpp(), null_yield, cfgstore.get());
-    if (ret < 0) {
-      std::cerr << "Unable to initialize site config." << std::endl;
-      exit(1);
-    }
     RGWPubSub ps(driver, tenant, &site->get_period()->get_map().zonegroups);
     rgw_pubsub_topics result;
     ret = ps.get_topics(dpp(), result, null_yield);
@@ -10705,12 +10698,6 @@ next:
       cerr << "ERROR: topic name was not provided (via --topic)" << std::endl;
       return EINVAL;
     }
-    auto site = std::make_unique<rgw::SiteConfig>();
-    ret = site->load(dpp(), null_yield, cfgstore.get());
-    if (ret < 0) {
-      std::cerr << "Unable to initialize site config." << std::endl;
-      exit(1);
-    }
     RGWPubSub ps(driver, tenant, &site->get_period()->get_map().zonegroups);
 
     rgw_pubsub_topic topic;
@@ -10788,12 +10775,6 @@ next:
       return -ret;
     }
 
-    auto site = std::make_unique<rgw::SiteConfig>();
-    ret = site->load(dpp(), null_yield, cfgstore.get());
-    if (ret < 0) {
-      std::cerr << "Unable to initialize site config." << std::endl;
-      exit(1);
-    }
     RGWPubSub ps(driver, tenant, &site->get_period()->get_map().zonegroups);
 
     ret = ps.remove_topic(dpp(), topic_name, null_yield);