Better handle N/A health from old versions

This commit is contained in:
Joshua Boniface 2023-02-23 10:22:00 -05:00
parent fe258d9d56
commit 765f0ef13d
1 changed files with 4 additions and 1 deletions

View File

@ -125,7 +125,10 @@ def format_info(cluster_information, oformat):
return json.dumps(cluster_information, indent=4) return json.dumps(cluster_information, indent=4)
# Plain formatting, i.e. human-readable # Plain formatting, i.e. human-readable
if cluster_information.get("maintenance") == "true": if (
cluster_information.get("maintenance") == "true"
or cluster_information.get("cluster_health", {}).get("health", "N/A") == "N/A"
):
health_colour = ansiprint.blue() health_colour = ansiprint.blue()
elif cluster_information.get("cluster_health", {}).get("health", 100) > 90: elif cluster_information.get("cluster_health", {}).get("health", 100) > 90:
health_colour = ansiprint.green() health_colour = ansiprint.green()