From: Sebastian Wagner Date: Thu, 22 Nov 2018 17:01:50 +0000 (+0100) Subject: ceph-volume: fix JSON output in `inventory` X-Git-Tag: v12.2.11~28^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F25922%2Fhead;p=ceph.git ceph-volume: fix JSON output in `inventory` Signed-off-by: Sebastian Wagner (cherry picked from commit a3e6f569b4fa0419dff4690a72e9be6fe0a255c1) --- diff --git a/src/ceph-volume/ceph_volume/inventory/main.py b/src/ceph-volume/ceph_volume/inventory/main.py index f4c732cab72f..1d821b602be1 100644 --- a/src/ceph-volume/ceph_volume/inventory/main.py +++ b/src/ceph-volume/ceph_volume/inventory/main.py @@ -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())