From d5885ebd34fdca4a10d5313015fa65614ea8d866 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Thu, 22 Nov 2018 18:01:50 +0100 Subject: [PATCH] ceph-volume: fix JSON output in `inventory` Signed-off-by: Sebastian Wagner (cherry picked from commit a3e6f569b4fa0419dff4690a72e9be6fe0a255c1) --- src/ceph-volume/ceph_volume/inventory/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ceph-volume/ceph_volume/inventory/main.py b/src/ceph-volume/ceph_volume/inventory/main.py index f4c732cab72f3..1d821b602be18 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()) -- 2.39.5