From cbcdf0506896e13badb32e336a435b2187fdd770 Mon Sep 17 00:00:00 2001 From: William Brown Date: Aug 24 2020 02:43:07 +0000 Subject: Ticket 51247 - Container Healthcheck failure Bug Description: Due to human error, a change to begin_healthcheck was overlooked that causes containers to always report an unhealthy state. Fix Description: Fix the use of begin_healthcheck fixes: https://pagure.io/389-ds-base/issue/51247 fixes #51247 Author: William Brown Review by: ??? --- diff --git a/src/lib389/cli/dscontainer b/src/lib389/cli/dscontainer index a519eef..098705a 100755 --- a/src/lib389/cli/dscontainer +++ b/src/lib389/cli/dscontainer @@ -330,6 +330,9 @@ binddn = cn=Directory Manager healthy = False max_failure_count = 20 for i in range(0, max_failure_count): + if ds_proc is None: + log.warning("ns-slapd pid has disappeared ...") + break (check_again, healthy) = begin_healthcheck(ds_proc) if check_again is False: break @@ -355,10 +358,9 @@ binddn = cn=Directory Manager def begin_healthcheck(ds_proc): - if ds_proc is None: - log.warning("ns-slapd pid has disappeared ...") - return (False, False) - if ds_proc.poll() is not None: + # We skip the pid check if ds_proc is none because that means it's coming from the + # container healthcheck. + if ds_proc is not None and ds_proc.poll() is not None: # Ruh-Roh log.warning("ns-slapd pid has completed, you should check the error log ...") return (False, False) @@ -425,7 +427,7 @@ container host. if args.runit: begin_magic() elif args.healthcheck: - if begin_healthcheck() is True: + if begin_healthcheck(None) is (False, True): sys.exit(0) else: sys.exit(1)