Properly sort status faults

This commit is contained in:
Joshua Boniface 2023-12-06 13:27:18 -05:00
parent d1e34e7333
commit 6fc5c927a1
1 changed files with 7 additions and 1 deletions

View File

@ -274,7 +274,13 @@ def cli_cluster_status_format_short(CLI_CONFIG, data):
) )
if messages is not None and len(messages) > 0: 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(f"{ansii['purple']}Faults:{ansii['end']} {messages}")
output.append("") output.append("")