From 3cfbb0a6d0baf888a66058d8242c0bd5cdf8ce1e Mon Sep 17 00:00:00 2001 From: Dennis Kuhn Date: Wed, 24 May 2023 16:53:39 +0200 Subject: [PATCH] Ignore consul members in status left in the consul health checks Don't fail the consul health check if there are nodes in status left --- rebootmgr/main.py | 3 ++- setup.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/rebootmgr/main.py b/rebootmgr/main.py index b6fe17f..b96a921 100644 --- a/rebootmgr/main.py +++ b/rebootmgr/main.py @@ -193,7 +193,8 @@ def check_consul_cluster(con, ignore_failed_checks: bool) -> None: LOG.warning("All consul cluster checks are ignored.") else: for member in con.agent.members(): - if "Status" in member.keys() and member["Status"] != 1 and member["Name"] not in whitelist: + # Consul member status 1 = Alive, 3 = Left + if "Status" in member.keys() and member["Status"] not in [1, 3] and member["Name"] not in whitelist: LOG.error("Consul cluster not healthy: Node %s failed. Exit" % member["Name"]) sys.exit(EXIT_CONSUL_NODE_FAILED) diff --git a/setup.py b/setup.py index 6d1a703..2cd432f 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name="rebootmgr", - version="0.0.26", + version="0.0.27", packages=find_packages(), include_package_data=True, install_requires=[