]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: support json format output for rados-admin policy command
authorDunrong Huang <riegamaths@gmail.com>
Wed, 3 Feb 2016 07:59:24 +0000 (15:59 +0800)
committerYehuda Sadeh <yehuda@redhat.com>
Thu, 10 Mar 2016 21:35:28 +0000 (13:35 -0800)
when use rados-admin to get policy with parameter --format=json:
$ radosgw-admin policy --bucket=m8x --format=json

policy information with json format should be output.

Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
src/rgw/rgw_admin.cc

index 8ff4044174dd44b8782669db01eee5ebb5bc5a25..d7ba50cccf2b69bd007eb89448ef9c2249aa55c2 100644 (file)
@@ -3462,9 +3462,10 @@ int main(int argc, char **argv)
   }
 
   if (opt_cmd == OPT_POLICY) {
-    int ret = RGWBucketAdminOp::get_policy(store, bucket_op, cout);
-    if (ret >= 0) {
-      cout << std::endl;
+    int ret = RGWBucketAdminOp::get_policy(store, bucket_op, f);
+    if (ret < 0) {
+      cerr << "ERROR: failed to get policy: " << cpp_strerror(-ret) << std::endl;
+      return -ret;
     }
   }