]> 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>
Tue, 5 Mar 2024 17:55:24 +0000 (12:55 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_admin.cc

index bbd9231893fb1f1a61e303714c9d6462f1785cff..be91c66e9ff870d49c28f6fdc7277aa7249fe178 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,
@@ -10651,12 +10650,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);
@@ -10700,12 +10693,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;
@@ -10783,12 +10770,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);