]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: user tools don't require formatter
authorYehuda Sadeh <yehuda@redhat.com>
Thu, 28 Jun 2018 22:20:52 +0000 (15:20 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 11 Dec 2018 08:10:41 +0000 (00:10 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_user.cc

index 95df6a48d5c17c0bdc9ca1f0397332af0fb01994..3efc728b37dd794c5c7e49d5785fbbc8e4907393 100644 (file)
@@ -2433,10 +2433,12 @@ int RGWUserAdminOp_User::info(RGWRados *store, RGWUserAdminOpState& op_state,
     arg_stats = &stats;
   }
 
-  flusher.start(0);
+  if (formatter) {
+    flusher.start(0);
 
-  dump_user_info(formatter, info, arg_stats);
-  flusher.flush();
+    dump_user_info(formatter, info, arg_stats);
+    flusher.flush();
+  }
 
   return 0;
 }
@@ -2463,10 +2465,12 @@ int RGWUserAdminOp_User::create(RGWRados *store, RGWUserAdminOpState& op_state,
   if (ret < 0)
     return ret;
 
-  flusher.start(0);
+  if (formatter) {
+    flusher.start(0);
 
-  dump_user_info(formatter, info);
-  flusher.flush();
+    dump_user_info(formatter, info);
+    flusher.flush();
+  }
 
   return 0;
 }
@@ -2492,10 +2496,12 @@ int RGWUserAdminOp_User::modify(RGWRados *store, RGWUserAdminOpState& op_state,
   if (ret < 0)
     return ret;
 
-  flusher.start(0);
+  if (formatter) {
+    flusher.start(0);
 
-  dump_user_info(formatter, info);
-  flusher.flush();
+    dump_user_info(formatter, info);
+    flusher.flush();
+  }
 
   return 0;
 }
@@ -2539,10 +2545,12 @@ int RGWUserAdminOp_Subuser::create(RGWRados *store, RGWUserAdminOpState& op_stat
   if (ret < 0)
     return ret;
 
-  flusher.start(0);
+  if (formatter) {
+    flusher.start(0);
 
-  dump_subusers_info(formatter, info);
-  flusher.flush();
+    dump_subusers_info(formatter, info);
+    flusher.flush();
+  }
 
   return 0;
 }
@@ -2568,11 +2576,13 @@ int RGWUserAdminOp_Subuser::modify(RGWRados *store, RGWUserAdminOpState& op_stat
   ret = user.info(info, NULL);
   if (ret < 0)
     return ret;
-  
-  flusher.start(0);
+  if (formatter) {
+    flusher.start(0);
 
-  dump_subusers_info(formatter, info);
-  flusher.flush();
+    dump_subusers_info(formatter, info);
+    flusher.flush();
+  }
 
   return 0;
 }
@@ -2619,17 +2629,19 @@ int RGWUserAdminOp_Key::create(RGWRados *store, RGWUserAdminOpState& op_state,
   if (ret < 0)
     return ret;
 
-  flusher.start(0);
+  if (formatter) {
+    flusher.start(0);
 
-  int key_type = op_state.get_key_type();
+    int key_type = op_state.get_key_type();
 
-  if (key_type == KEY_TYPE_SWIFT)
-    dump_swift_keys_info(formatter, info);
+    if (key_type == KEY_TYPE_SWIFT)
+      dump_swift_keys_info(formatter, info);
 
-  else if (key_type == KEY_TYPE_S3)
-    dump_access_keys_info(formatter, info);
+    else if (key_type == KEY_TYPE_S3)
+      dump_access_keys_info(formatter, info);
 
-  flusher.flush();
+    flusher.flush();
+  }
 
   return 0;
 }
@@ -2676,10 +2688,12 @@ int RGWUserAdminOp_Caps::add(RGWRados *store, RGWUserAdminOpState& op_state,
   if (ret < 0)
     return ret;
 
-  flusher.start(0);
+  if (formatter) {
+    flusher.start(0);
 
-  info.caps.dump(formatter);
-  flusher.flush();
+    info.caps.dump(formatter);
+    flusher.flush();
+  }
 
   return 0;
 }
@@ -2707,10 +2721,12 @@ int RGWUserAdminOp_Caps::remove(RGWRados *store, RGWUserAdminOpState& op_state,
   if (ret < 0)
     return ret;
 
-  flusher.start(0);
+  if (formatter) {
+    flusher.start(0);
 
-  info.caps.dump(formatter);
-  flusher.flush();
+    info.caps.dump(formatter);
+    flusher.flush();
+  }
 
   return 0;
 }