]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: permit rgw-admin to populate user info by access-key 30105/head
authorMatt Benjamin <mbenjamin@redhat.com>
Thu, 30 May 2019 18:12:39 +0000 (14:12 -0400)
committerNathan Cutler <ncutler@suse.com>
Tue, 3 Sep 2019 14:08:58 +0000 (16:08 +0200)
This enables, in particular,

  radosgw-admin user info --access-key=<foo-key>

to work.

Fixes: https://tracker.ceph.com/issues/39261
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
(cherry picked from commit 7b6a7ae84faccd543c0d1a528661b766de7c593d)

src/rgw/rgw_admin.cc

index b0468abc9e343c3bcff8d2ba707c4c944ee15f93..b784f662b397b8889cb3938b1fef5448d901e901 100644 (file)
@@ -4894,7 +4894,7 @@ int main(int argc, const char **argv)
   // RGWUser to use for user operations
   RGWUser user;
   int ret = 0;
-  if (!user_id.empty() || !subuser.empty()) {
+  if (!(user_id.empty() && access_key.empty()) || !subuser.empty()) {
     ret = user.init(store, user_op);
     if (ret < 0) {
       cerr << "user.init failed: " << cpp_strerror(-ret) << std::endl;
@@ -4917,8 +4917,8 @@ int main(int argc, const char **argv)
 
   switch (opt_cmd) {
   case OPT_USER_INFO:
-    if (user_id.empty()) {
-      cerr << "ERROR: uid not specified" << std::endl;
+    if (user_id.empty() && access_key.empty()) {
+      cerr << "ERROR: --uid or --access-key required" << std::endl;
       return EINVAL;
     }
     break;