From abfd6653467780d33fca5d4351ccd8447484f24d Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Sun, 1 Oct 2017 20:27:30 +0200 Subject: [PATCH] Consider ourselves unhealthy if fetching from localhost fails --- modules/roles/files/mirror_health/mirror-health | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/roles/files/mirror_health/mirror-health b/modules/roles/files/mirror_health/mirror-health index d3df95f37..a4df165a3 100755 --- a/modules/roles/files/mirror_health/mirror-health +++ b/modules/roles/files/mirror_health/mirror-health @@ -45,7 +45,10 @@ def check_uptodate(): latest_ts = max(latest_ts, lm) except (requests.exceptions.ProxyError, requests.exceptions.ReadTimeout): pass - local_lm = last_modified(retrieve_from_host('localhost', URL)) + try: + local_lm = last_modified(retrieve_from_host('localhost', URL)) + except (requests.exceptions.ProxyError, requests.exceptions.ReadTimeout): + return False logging.debug("lm for localhost: %s", local_lm) if local_lm < latest_ts: logging.info("considering myself unhealthy my ts=%s latest_ts=%s", local_lm, latest_ts) -- 2.20.1