From: Patrick Donnelly Date: Sun, 14 Jun 2020 03:26:35 +0000 (-0700) Subject: qa: quietly print json output from asok commands X-Git-Tag: v16.1.0~1933^2~23 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f451c43aca58945ca5d4646bf057e009deb0a787;p=ceph.git qa: quietly print json output from asok commands Pretty print output once. Use --format=json so the stdout on teuthology is not pretty printed, taking hundreds of lines. Signed-off-by: Patrick Donnelly --- diff --git a/qa/tasks/cephfs/filesystem.py b/qa/tasks/cephfs/filesystem.py index 00da71cbed84..0f72c8ee7eb7 100644 --- a/qa/tasks/cephfs/filesystem.py +++ b/qa/tasks/cephfs/filesystem.py @@ -223,12 +223,16 @@ class CephCluster(object): def json_asok(self, command, service_type, service_id, timeout=None): if timeout is None: timeout = 15*60 + command.insert(0, '--format=json') proc = self.mon_manager.admin_socket(service_type, service_id, command, timeout=timeout) - response_data = proc.stdout.getvalue() - log.info("_json_asok output: {0}".format(response_data)) - if response_data.strip(): - return json.loads(response_data) + response_data = proc.stdout.getvalue().strip() + if len(response_data) > 0: + j = json.loads(response_data) + pretty = json.dumps(j, sort_keys=True, indent=2) + log.debug(f"_json_asok output\n{pretty}") + return j else: + log.debug(f"_json_asok output empty") return None