]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: fix JSON output in `inventory` 25923/head
authorSebastian Wagner <sebastian.wagner@suse.com>
Thu, 22 Nov 2018 17:01:50 +0000 (18:01 +0100)
committerAlfredo Deza <adeza@redhat.com>
Fri, 11 Jan 2019 18:53:28 +0000 (13:53 -0500)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
(cherry picked from commit a3e6f569b4fa0419dff4690a72e9be6fe0a255c1)

src/ceph-volume/ceph_volume/inventory/main.py

index f4c732cab72f393368879eea24c8513ddbc42f58..1d821b602be18329330a800174e90ab1738074f7 100644 (file)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 import argparse
-import pprint
+import json
 
 from ceph_volume.util.device import Devices, Device
 
@@ -39,8 +39,8 @@ class Inventory(object):
 
     def format_report(self, inventory):
         if self.args.format == 'json':
-            print(inventory.json_report())
+            print(json.dumps(inventory.json_report()))
         elif self.args.format == 'json-pretty':
-            pprint.pprint(inventory.json_report())
+            print(json.dumps(inventory.json_report(), indent=4, sort_keys=True))
         else:
             print(inventory.pretty_report())