]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
radosgw-admin: add --uid check in bucket list command 30604/head
authorVikhyat Umrao <vumrao@redhat.com>
Thu, 5 Sep 2019 23:39:51 +0000 (16:39 -0700)
committerVikhyat Umrao <vumrao@redhat.com>
Thu, 26 Sep 2019 22:39:59 +0000 (15:39 -0700)
Fixes: https://tracker.ceph.com/issues/41589
Signed-off-by: Vikhyat Umrao <vumrao@redhat.com>
(cherry picked from commit c53597b561837340314f0a169f6881c1814ce0b9)

 Conflicts:
src/rgw/rgw_admin.cc
        - no --new-uid

src/rgw/rgw_admin.cc

index da50a90a6e4050c443c86ee5bbf18e380401263c..8c52dd15246de69ffe447add485db8f516e1e5d1 100644 (file)
@@ -2897,6 +2897,10 @@ int main(int argc, const char **argv)
       break;
     } else if (ceph_argparse_witharg(args, i, &val, "-i", "--uid", (char*)NULL)) {
       user_id.from_str(val);
+      if (user_id.empty()) {
+        cerr << "no value for uid" << std::endl;
+        exit(1);
+      }
     } else if (ceph_argparse_witharg(args, i, &val, "--tenant", (char*)NULL)) {
       tenant = val;
     } else if (ceph_argparse_witharg(args, i, &val, "--access-key", (char*)NULL)) {
@@ -5462,6 +5466,12 @@ int main(int argc, const char **argv)
 
   if (opt_cmd == OPT_BUCKETS_LIST) {
     if (bucket_name.empty()) {
+      if (!user_id.empty()) {
+        if (!user_op.has_existing_user()) {
+          cerr << "ERROR: could not find user: " << user_id << std::endl;
+          return -ENOENT;
+        }
+      }
       RGWBucketAdminOp::info(store, bucket_op, f);
     } else {
       RGWBucketInfo bucket_info;