]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: remove unused librgw_admin_user 34179/head
authorCasey Bodley <cbodley@redhat.com>
Wed, 25 Mar 2020 14:50:07 +0000 (10:50 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 25 Mar 2020 18:12:55 +0000 (14:12 -0400)
unused and not worth the effort to maintain

Signed-off-by: Casey Bodley <cbodley@redhat.com>
ceph.spec.in
debian/librgw-dev.install
debian/librgw2.install
src/include/CMakeLists.txt
src/include/rgw/librgw_admin_user.h [deleted file]
src/rgw/CMakeLists.txt
src/rgw/librgw_admin_user.cc [deleted file]
src/test/CMakeLists.txt
src/test/test_librgw_admin_user.cc [deleted file]

index c91472d4b1e559f49e31d3667579aab60a0359b0..20f8f87f9250fdf245e9bad3c94ae33afb9f5c5e 100644 (file)
@@ -2137,7 +2137,6 @@ fi
 
 %files -n librgw2
 %{_libdir}/librgw.so.*
-%{_libdir}/librgw_admin_user.so.*
 %if %{with lttng}
 %{_libdir}/librgw_op_tp.so.*
 %{_libdir}/librgw_rados_tp.so.*
@@ -2150,10 +2149,8 @@ fi
 %files -n librgw-devel
 %dir %{_includedir}/rados
 %{_includedir}/rados/librgw.h
-%{_includedir}/rados/librgw_admin_user.h
 %{_includedir}/rados/rgw_file.h
 %{_libdir}/librgw.so
-%{_libdir}/librgw_admin_user.so
 %if %{with lttng}
 %{_libdir}/librgw_op_tp.so
 %{_libdir}/librgw_rados_tp.so
index 1f4f1b190bad4948308c9465eae9f3d42edf2e59..ed2a81dba5013a2be67fec3e78bf2c1f918de02d 100644 (file)
@@ -1,5 +1,3 @@
 usr/include/rados/librgw.h
-usr/include/rados/librgw_admin_user.h
 usr/include/rados/rgw_file.h
 usr/lib/librgw.so
-usr/lib/librgw_admin_user.so
index 725f341affa4818da526d58e7e83f9f988dcc719..b86fb891e2c255505fae45fb03f7dc2597b0b0a2 100644 (file)
@@ -1,2 +1 @@
 usr/lib/librgw.so.*
-usr/lib/librgw_admin_user.so.*
index 39cdc6b2bf42f095f71d32cd96528bed44e8d293..77eb4093a80aa3b34859748c2c78acdc460fe5cc 100644 (file)
@@ -30,6 +30,5 @@ if(WITH_RADOSGW)
   install(FILES
     rados/librgw.h
     rados/rgw_file.h
-    rgw/librgw_admin_user.h
-  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rados)
+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rados)
 endif()
diff --git a/src/include/rgw/librgw_admin_user.h b/src/include/rgw/librgw_admin_user.h
deleted file mode 100644 (file)
index e1dd5a2..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-/*
- * create rgw admin user
- *
- * Copyright (C) 2015 Red Hat, Inc.
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
- * Foundation.  See file COPYING.
- *
- */
-
-#ifndef LIB_RGW_ADMIN_USER_H
-#define LIB_RGW_ADMIN_USER_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define LIBRGW_ADMIN_USER_VER_MAJOR 1
-#define LIBRGW_ADMIN_USER_VER_MINOR 0
-#define LIBRGW_ADMIN_USER_VER_EXTRA 0
-
-#define LIBRGW_ADMIN_USER_VERSION(maj, min, extra) ((maj << 16) + (min << 8) + extra)
-#define LIBRGW_ADMIN_USER_VERSION_CODE LIBRGW_ADMIN_USER_VERSION(LIBRGW_ADMIN_USER_VER_MAJOR, LIBRGW_ADMIN_USER_VER_MINOR, LIBRGW_ADMIN_USER_VER_EXTRA)
-
-typedef void* librgw_admin_user_t;
-int librgw_admin_user_create(librgw_admin_user_t *rgw_admin_user, int argc, char **argv);
-void librgw_admin_user_shutdown(librgw_admin_user_t rgw_admin_user);
-
-struct rgw_user_info
-{
-  const char *uid;
-  const char *display_name;
-  const char *access_key;
-  const char* secret_key;
-  const char* email;
-  const char *caps;
-  const char *access;
-  bool admin;
-  bool system;
-};
-
- /*
- * create a new rgw user
- */
-int rgw_admin_create_user(librgw_admin_user_t rgw_admin_user, const char *uid,
-                         const char *display_name,  const char *access_key, const char* secret_key,
-                         const char *email, const char *caps,
-                         const char *access, bool admin, bool system);
-
-/*
- * get rgw user info
- */
-int rgw_admin_user_info(librgw_admin_user_t rgw_admin_user,const char * uid, rgw_user_info* user_info);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LIBRGW_ADMIN_USER */
index 2dae1f2c81deb24f3bc0ca64731040c39bb3274a..bfacafc41e8652e377b31b816a15687b448c45c7 100644 (file)
@@ -393,45 +393,6 @@ set_target_properties(rgw PROPERTIES OUTPUT_NAME rgw VERSION 2.0.0
   SOVERSION 2)
 install(TARGETS rgw DESTINATION ${CMAKE_INSTALL_LIBDIR})
 
-set(librgw_admin_user_srcs
-  librgw_admin_user.cc
-  rgw_admin_user.cc
-)
-add_library(rgw_admin_user SHARED
-    ${librgw_admin_user_srcs}
-    $<TARGET_OBJECTS:rgw_common>)
-
-add_dependencies(rgw_admin_user civetweb_h)
-
-target_link_libraries(rgw_admin_user PRIVATE
-  librados
-  cls_rgw_client
-  cls_otp_client
-  cls_lock_client
-  cls_refcount_client
-  cls_log_client
-  cls_timeindex_client
-  cls_version_client
-  cls_user_client
-  cls_rgw_gc_client
-  global
-  ${CURL_LIBRARIES}
-  ${EXPAT_LIBRARIES}
-  ${OPENLDAP_LIBRARIES}
-  dmclock::dmclock)
-set_target_properties(rgw_admin_user PROPERTIES OUTPUT_NAME rgw_admin_user VERSION 1.0.0
-  SOVERSION 0)
-install(TARGETS rgw_admin_user DESTINATION ${CMAKE_INSTALL_LIBDIR})
-if(WITH_RADOSGW_AMQP_ENDPOINT)
-  target_link_libraries(rgw_admin_user PRIVATE RabbitMQ::RabbitMQ)
-endif()
-if(WITH_RADOSGW_KAFKA_ENDPOINT)
-  target_link_libraries(rgw_admin_user PRIVATE RDKafka::RDKafka)
-endif()
-if(WITH_BOOST_CONTEXT)
-  target_link_libraries(rgw_admin_user PRIVATE spawn)
-endif()
-
 if(WITH_TESTS)
   add_executable(ceph_rgw_jsonparser
     rgw_jsonparser.cc)
diff --git a/src/rgw/librgw_admin_user.cc b/src/rgw/librgw_admin_user.cc
deleted file mode 100644 (file)
index 2c1f0ae..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab ft=cpp
-
-/*
- * create rgw admin user
- *
- * Copyright (C) 2015 Red Hat, Inc.
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
- * Foundation.  See file COPYING.
- *
- */
-
-#include "include/compat.h"
-#include <sys/types.h>
-#include <string.h>
-#include <chrono>
-#include <errno.h>
-#include <thread>
-#include <string>
-#include <mutex>
-
-#include "include/types.h"
-#include "include/rgw/librgw_admin_user.h"
-#include "include/str_list.h"
-#include "include/stringify.h"
-#include "global/global_init.h"
-#include "global/signal_handler.h"
-#include "common/config.h"
-#include "common/errno.h"
-#include "common/Timer.h"
-#include "common/Throttle.h"
-#include "common/WorkQueue.h"
-#include "common/ceph_argparse.h"
-#include "common/ceph_context.h"
-#include "common/common_init.h"
-#include "common/dout.h"
-
-#include "rgw_admin_user.h"
-#include "rgw_rados.h"
-#include "rgw_os_lib.h"
-#include "rgw_auth.h"
-#include "rgw_auth_s3.h"
-
-#define dout_subsys ceph_subsys_rgw
-
-bool global_stop = false;
-
-static void handle_sigterm(int signum)
-{
-  dout(20) << __func__ << " SIGUSR1 ignored" << dendl;
-}
-
-namespace rgw {
-
-  using std::string;
-
-  static std::mutex librgw_admin_user_mtx;
-
-  RGWLibAdmin rgw_lib_admin;
-
-  class C_InitTimeout : public Context {
-  public:
-    C_InitTimeout() {}
-    void finish(int r) override {
-      derr << "Initialization timeout, failed to initialize" << dendl;
-      exit(1);
-    }
-  };
-
-  int RGWLibAdmin::init()
-  {
-    vector<const char*> args;
-    return init(args);
-  }
-
-  int RGWLibAdmin::init(vector<const char*>& args)
-  {
-    /* alternative default for module */
-    map<string,string> defaults = {
-      { "debug_rgw", "1/5" },
-      { "keyring", "$rgw_data/keyring" },
-      { "log_file", "/var/log/radosgw/$cluster-$name.log" }
-    };
-
-    cct = global_init(&defaults, args,
-                     CEPH_ENTITY_TYPE_CLIENT,
-                     CODE_ENVIRONMENT_UTILITY, 0);
-
-    ceph::mutex mutex = ceph::make_mutex("main");
-    SafeTimer init_timer(g_ceph_context, mutex);
-    init_timer.init();
-    mutex.lock();
-    init_timer.add_event_after(g_conf()->rgw_init_timeout, new C_InitTimeout);
-    mutex.unlock();
-
-    common_init_finish(g_ceph_context);
-
-    store = RGWStoreManager::get_storage(g_ceph_context, false, false, false, false, false);
-
-    if (!store) {
-      mutex.lock();
-      init_timer.cancel_all_events();
-      init_timer.shutdown();
-      mutex.unlock();
-
-      derr << "Couldn't init storage provider (RADOS)" << dendl;
-      return -EIO;
-    }
-
-    mutex.lock();
-    init_timer.cancel_all_events();
-    init_timer.shutdown();
-    mutex.unlock();
-
-    init_async_signal_handler();
-    register_async_signal_handler(SIGUSR1, handle_sigterm);
-
-    return 0;
-  } /* RGWLibAdmin::init() */
-
-  int RGWLibAdmin::stop()
-  {
-    derr << "shutting down" << dendl;
-
-    unregister_async_signal_handler(SIGUSR1, handle_sigterm);
-    shutdown_async_signal_handler();
-
-    RGWStoreManager::close_storage(store);
-
-    dout(1) << "final shutdown" << dendl;
-    cct.reset();
-
-    return 0;
-  } /* RGWLibAdmin::stop() */
-
-} /* namespace rgw */
-
-extern "C" {
-
-int librgw_admin_user_create(librgw_admin_user_t* rgw_admin_user, int argc, char **argv)
-{
-  using namespace rgw;
-
-  int rc = -EINVAL;
-
-  if (! g_ceph_context) {
-    std::lock_guard<std::mutex> lg(librgw_admin_user_mtx);
-    if (! g_ceph_context) {
-      vector<const char*> args;
-      std::vector<std::string> spl_args;
-      // last non-0 argument will be split and consumed
-      if (argc > 1) {
-       const std::string spl_arg{argv[(--argc)]};
-       get_str_vec(spl_arg, " \t", spl_args);
-      }
-      argv_to_vec(argc, const_cast<const char**>(argv), args);
-      // append split args, if any
-      for (const auto& elt : spl_args) {
-       args.push_back(elt.c_str());
-      }
-      rc = rgw_lib_admin.init(args);
-    }
-  }
-
-  *rgw_admin_user = g_ceph_context->get();
-
-  return rc;
-}
-
-void librgw_admin_user_shutdown(librgw_admin_user_t rgw_admin_user)
-{
-  using namespace rgw;
-
-  CephContext* cct = static_cast<CephContext*>(rgw_admin_user);
-  rgw_lib_admin.stop();
-  cct->put();
-}
-
-} /* extern "C" */
-
-
index 82208219e7873aa5e14033d02134196ea9f432c0..bc69f8e1e19bc76bfed18d47ac0a83bc8c66ec88 100644 (file)
@@ -107,11 +107,6 @@ if(WITH_RADOSGW)
   target_link_libraries(test_build_librgw rgw_a pthread ${CRYPTO_LIBS} ${EXTRALIBS})
 endif(WITH_RADOSGW)
 
-if(WITH_RADOSGW)
-  add_executable(test_build_librgw_admin_user buildtest_skeleton.cc)
-  target_link_libraries(test_build_librgw_admin_user pthread ${CRYPTO_LIBS} ${EXTRALIBS})
-endif(WITH_RADOSGW)
-
 if(WITH_LIBCEPHFS)
   # From src/test/Makefile-client.am: I dont get this one... testing the osdc build but link in libcephfs?
   add_executable(test_build_libcephfs buildtest_skeleton.cc)
@@ -345,18 +340,6 @@ target_link_libraries(test_rgw_ldap
   ${OPENLDAP_LIBRARIES}
   ${UNITTEST_LIBS}
   )
-
-# unittest_librgw_admin_user
-add_executable(ceph_test_librgw_admin_user test_librgw_admin_user.cc)
-target_link_libraries(ceph_test_librgw_admin_user
-  rgw_admin_user
-  cls_otp_client
-  librados
-  ceph-common
-  ${UNITTEST_LIBS}
-  ${EXTRALIBS}
-   )
-
 endif(${WITH_RADOSGW})
 
 # ceph_multi_stress_watch
diff --git a/src/test/test_librgw_admin_user.cc b/src/test/test_librgw_admin_user.cc
deleted file mode 100644 (file)
index 6b9df1c..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2015 Red Hat, Inc.
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
- * Foundation.  See file COPYING.
- *
- */
-
-#include <string.h>
-#include "gtest/gtest.h"
-#include "common/ceph_argparse.h"
-
-#include "include/rgw/librgw_admin_user.h"
-
-#define dout_subsys ceph_subsys_rgw
-
-namespace {
-  librgw_admin_user_t rgw = nullptr;
-  std::string uid("testuser");
-  std::string display_name("testuser");
-  std::string access_key("");
-  std::string secret_key("");
-  std::string email;
-  std::string caps;
-  std::string access_str;
-  bool admin;
-  bool system_user;
-
-  struct {
-    int argc;
-    char **argv;
-  } saved_args;
-}
-
-TEST(RGWLibAdmin, INIT) {
-  int ret = librgw_admin_user_create(&rgw, saved_args.argc, saved_args.argv);
-  ASSERT_EQ(ret, 0);
-  ASSERT_NE(rgw, nullptr);
-}
-
-TEST(RGWLibAdmin, CREATE) {
-  int ret = rgw_admin_create_user(rgw, uid.c_str(), display_name.c_str(),
-                                 access_key.c_str(), secret_key.c_str(), caps.c_str(), access_str.c_str(), email.c_str(),
-                                 admin, system_user);
-  ASSERT_EQ(ret, 0);
-}
-
-TEST(RGWLibAdmin, INFO) {
-  struct rgw_user_info user_info;
-  int ret = rgw_admin_user_info(rgw, uid.c_str(), &user_info);
-  ASSERT_EQ(ret, 0);
-}
-
-TEST(RGWLibAdmin, SHUTDOWN) {
-  librgw_admin_user_shutdown(rgw);
-}
-
-int main(int argc, char *argv[])
-{
-  char *v{nullptr};
-  std::string val;
-  std::vector<const char*> args;
-
-  argv_to_vec(argc, const_cast<const char**>(argv), args);
-  env_to_vec(args);
-
-  v = getenv("AWS_ACCESS_KEY_ID");
-  if (v) {
-    access_key = v;
-  }
-
-  v = getenv("AWS_SECRET_ACCESS_KEY");
-  if (v) {
-    secret_key = v;
-  }
-
-  for (auto arg_iter = args.begin(); arg_iter != args.end();) {
-    if (ceph_argparse_witharg(args, arg_iter, &val, "--access",
-                             (char*) nullptr)) {
-      access_key = val;
-    } else if (ceph_argparse_witharg(args, arg_iter, &val, "--secret",
-                                    (char*) nullptr)) {
-      secret_key = val;
-    } else if (ceph_argparse_witharg(args, arg_iter, &val, "--uid",
-                                    (char*) nullptr)) {
-      uid = val;
-    } else {
-      ++arg_iter;
-    }
-  }
-
-  saved_args.argc = argc;
-  saved_args.argv = argv;
-
-  ::testing::InitGoogleTest(&argc, argv);
-  return RUN_ALL_TESTS();
-}
-