From 0058f19d885d9700e854f38b603e1c4e444ed11a Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sat, 2 Oct 2021 01:28:39 -0400 Subject: [PATCH] Fix handling of array of information With a benchmark info we only ever want test one, so pass only that to the formatter. Simplifies the format function. --- client-cli/pvc/cli_lib/ceph.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client-cli/pvc/cli_lib/ceph.py b/client-cli/pvc/cli_lib/ceph.py index c699ee5c..649ebf85 100644 --- a/client-cli/pvc/cli_lib/ceph.py +++ b/client-cli/pvc/cli_lib/ceph.py @@ -1601,21 +1601,21 @@ def format_info_benchmark(config, oformat, benchmark_information): 0: format_info_benchmark_legacy, } - benchmark_version = benchmark_information['test_format'] + benchmark_version = benchmark_information[0]['test_format'] if oformat == 'json-pretty': return dumps(benchmark_information, indent=4) elif oformat == 'json': return dumps(benchmark_information) else: - return benchmark_matrix.get(benchmark_version, lambda: 'Invalid format function')(config, benchmark_information) + return benchmark_matrix.get(benchmark_version, lambda: 'Invalid format function')(config, benchmark_information[0]) def format_info_benchmark_legacy(config, benchmark_information): - if benchmark_information[0]['benchmark_result'] == "Running": + if benchmark_information['benchmark_result'] == "Running": return "Benchmark test is still running." - benchmark_details = benchmark_information[0]['benchmark_result'] + benchmark_details = benchmark_information['benchmark_result'] # Format a nice output; do this line-by-line then concat the elements at the end ainformation = []