]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools: Fix newlines in output of --op list
authorDavid Zafman <dzafman@redhat.com>
Thu, 11 Jun 2015 00:04:57 +0000 (17:04 -0700)
committerDavid Zafman <dzafman@redhat.com>
Thu, 25 Feb 2016 20:50:24 +0000 (12:50 -0800)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit 6aec38b51f0c14684912b5ee28fb5b1375cb8f8a)

src/tools/ceph_objectstore_tool.cc

index c5e930755a2d8f07d7adafea1e435b13ee16e540..95492bcaf88af6369282a81cbecf838de0ad22d5 100644 (file)
@@ -544,10 +544,6 @@ struct pgid_object_list {
     for (list<pair<coll_t, ghobject_t> >::const_iterator i = _objects.begin();
         i != _objects.end();
         ++i) {
-      if (i != _objects.begin() && human_readable) {
-        f->flush(cout);
-        cout << std::endl;
-      }
       f->open_array_section("pgid_object");
       string pgid = i->first.c_str();
       std::size_t pos = pgid.find("_");
@@ -559,9 +555,16 @@ struct pgid_object_list {
       i->second.dump(f);
       f->close_section();
       f->close_section();
+      if (human_readable) {
+        f->flush(cout);
+        cout << std::endl;
+      }
     }
-    if (!human_readable)
+    if (!human_readable) {
       f->close_section();
+      f->flush(cout);
+      cout << std::endl;
+    }
   }
 };
 
@@ -2202,7 +2205,6 @@ int do_list(ObjectStore *store, string pgidstr, string object, Formatter *format
     return r;
   lookup.dump(formatter, human_readable);
   formatter->flush(cout);
-  cout << std::endl;
   return 0;
 }