From 6fc5c927a12087ff473568293f5ab29a1ec27285 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 6 Dec 2023 13:27:18 -0500 Subject: [PATCH] Properly sort status faults --- client-cli/pvc/cli/formatters.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client-cli/pvc/cli/formatters.py b/client-cli/pvc/cli/formatters.py index 30c9414c..52c2ab98 100644 --- a/client-cli/pvc/cli/formatters.py +++ b/client-cli/pvc/cli/formatters.py @@ -274,7 +274,13 @@ def cli_cluster_status_format_short(CLI_CONFIG, data): ) if messages is not None and len(messages) > 0: - messages = "\n ".join(sorted(messages)) + messages = "\n ".join( + sorted( + messages, + key=lambda x: (x["state"], x["health_delta"], x["last_reported"]), + reverse=True, + ) + ) output.append(f"{ansii['purple']}Faults:{ansii['end']} {messages}") output.append("")