]> 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>
Fri, 10 Jul 2015 17:10:43 +0000 (10:10 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/tools/ceph_objectstore_tool.cc

index bc031b68d78909476b6579120b3b41f47c1f2e50..6454b348486682acb94837b4ad0936c8dbe221c6 100644 (file)
@@ -227,10 +227,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");
       spg_t pgid;
       if (i->first.is_pg(&pgid))
@@ -239,9 +235,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;
+    }
   }
 };
 
@@ -1380,7 +1383,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;
 }