From dd24f517583c0334541b24bb1f9aafa86cf61968 Mon Sep 17 00:00:00 2001 From: Dunrong Huang Date: Wed, 3 Feb 2016 15:59:24 +0800 Subject: [PATCH] rgw: support json format output for rados-admin policy command 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 --- src/rgw/rgw_admin.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 8ff4044174dd4..d7ba50cccf2b6 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -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; } } -- 2.39.5