Skip to content

Commit

Permalink
rgw/dbstore: Insert testid user on startup
Browse files Browse the repository at this point in the history
Its temporary change to insert testid user while
starting up rgw server on dbstore.

Signed-off-by: Soumya Koduri <skoduri@redhat.com>
  • Loading branch information
soumyakoduri committed Sep 13, 2021
1 parent 89e8c55 commit 40480a9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/rgw/rgw_main.cc
Expand Up @@ -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"

Expand Down
13 changes: 13 additions & 0 deletions src/rgw/rgw_sal.cc
Expand Up @@ -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
}
Expand Down

0 comments on commit 40480a9

Please sign in to comment.