From: neeraj pratap singh Date: Wed, 18 Oct 2023 08:52:56 +0000 (+0530) Subject: qa: fix rank_asok() to handle errors from asok commands X-Git-Tag: testing/wip-pdonnell-testing-20240430.123648-reef-debug~199^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=dbf70cf13edf261df1e7bda514745fab3325e760;p=ceph-ci.git qa: fix rank_asok() to handle errors from asok commands Fixes: https://tracker.ceph.com/issues/63176 Signed-off-by: Neeraj Pratap Singh (cherry picked from commit 4af9f8eb6c189fcaec07ac64949c3037a92e7e8c) --- diff --git a/qa/tasks/cephfs/filesystem.py b/qa/tasks/cephfs/filesystem.py index 6541b70b76a..80044af214e 100644 --- a/qa/tasks/cephfs/filesystem.py +++ b/qa/tasks/cephfs/filesystem.py @@ -261,8 +261,14 @@ class CephCluster(object): "-Infinity": -float("inf")} return c[value] - j = json.loads(response_data.replace('inf', 'Infinity'), - parse_constant=get_nonnumeric_values) + + j = {} + try: + j = json.loads(response_data.replace('inf', 'Infinity'), + parse_constant=get_nonnumeric_values) + except json.decoder.JSONDecodeError: + raise RuntimeError(response_data) # assume it is an error message, pass it up + pretty = json.dumps(j, sort_keys=True, indent=2) log.debug(f"_json_asok output\n{pretty}") return j