From ab58c92c6e8ece89cfd6c857eb4e5a48282ff88a Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Sat, 30 Sep 2017 21:52:41 +0200 Subject: [PATCH] Fix name of variable (it is a timestamp, not a zone) and log a bit more --- modules/roles/files/mirror_health/mirror-health | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/roles/files/mirror_health/mirror-health b/modules/roles/files/mirror_health/mirror-health index 0e10fa71d..f70cf7162 100755 --- a/modules/roles/files/mirror_health/mirror-health +++ b/modules/roles/files/mirror_health/mirror-health @@ -14,7 +14,7 @@ HEALTH_FILE = os.path.join(OUTPUT_DIR, "health") URL = os.environ['MIRROR_CHECK_URL'] INTERVAL = int(os.environ.get('MIRROR_CHECK_INTERVAL', '60')) -latest_tz = 0 +latest_ts = 0 def retrieve_from_host(host, url): proxies = { @@ -34,18 +34,18 @@ while True: for host in HOSTS: lm = last_modified(retrieve_from_host(host, URL)) logging.debug("lm for host %s: %s", host, lm) - if lm > latest_tz: - latest_tz = lm + if lm > latest_ts: + latest_ts = lm local_lm = last_modified(retrieve_from_host('localhost', URL)) logging.debug("lm for localhost: %s", lm) - if latest_tz <= local_lm: + if latest_ts <= local_lm: try: - logging.debug("considering myself unhealthy") + logging.info("considering myself unhealthy my ts=%s latest_ts=%s", local_lm, latest_ts) os.remove(HEALTH_FILE) except OSError: pass else: - logging.debug("considering myself healthy") + logging.info("considering myself healthy") open(HEALTH_FILE, 'w').write("OK") sleep_time = start + INTERVAL - time.time() logging.debug("sleeping for %d seconds", sleep_time) -- 2.20.1