From dbf70cf13edf261df1e7bda514745fab3325e760 Mon Sep 17 00:00:00 2001 From: neeraj pratap singh Date: Wed, 18 Oct 2023 14:22:56 +0530 Subject: [PATCH] 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) --- qa/tasks/cephfs/filesystem.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 -- 2.39.5