]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/dbstore: Insert testid user on startup 43054/head
authorSoumya Koduri <skoduri@redhat.com>
Wed, 8 Sep 2021 19:10:10 +0000 (00:40 +0530)
committerSoumya Koduri <skoduri@redhat.com>
Mon, 20 Sep 2021 13:14:47 +0000 (18:44 +0530)
Its temporary change to insert testid user while
starting up rgw server on dbstore.

Signed-off-by: Soumya Koduri <skoduri@redhat.com>
src/rgw/rgw_main.cc
src/rgw/rgw_sal.cc

index b905aa5c64df4a158744b980bac99380d32b5944..dba733786cb66385b894ac90a75041705ab05499 100644 (file)
@@ -53,6 +53,9 @@
 #ifdef WITH_RADOSGW_LUA_PACKAGES
 #include "rgw_lua.h"
 #endif
+#ifdef WITH_RADOSGW_DBSTORE
+#include "rgw_sal_dbstore.h"
+#endif
 
 #include "services/svc_zone.h"
 
index 5917280bca97eee40dfa225e0940c9c74b4fd515..c22d9e162dbc1f682ed68966bb0c8e9fce67868d 100644 (file)
@@ -83,6 +83,19 @@ rgw::sal::Store* StoreManager::init_storage_provider(const DoutPrefixProvider* d
     /* Initialize the dbstore with cct & dpp */
     DB *db = static_cast<rgw::sal::DBStore *>(store)->getDB();
     db->set_context(cct);
+
+    /* XXX: temporary - create testid user */
+    rgw_user testid_user("", "testid", "");
+    std::unique_ptr<rgw::sal::User> user = store->get_user(testid_user);
+    user->get_info().display_name = "M. Tester";
+    user->get_info().user_email = "tester@ceph.com";
+    RGWAccessKey k1("0555b35654ad1656d804", "h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q==");
+    user->get_info().access_keys["0555b35654ad1656d804"] = k1;
+
+    int r = user->store_user(dpp, null_yield, true);
+    if (r < 0) {
+      ldpp_dout(dpp, 0) << "ERROR: failed inserting testid user in dbstore error r=" << r << dendl;
+    }
     return store;
 #endif
   }