From 80771bfbf9b566ee859996074f894111f5614523 Mon Sep 17 00:00:00 2001 From: "kevin.cho" Date: Fri, 8 Nov 2019 18:20:17 +0900 Subject: [PATCH] Fix bug in checking healthChecks at first (#655) --- marathon_lb.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/marathon_lb.py b/marathon_lb.py index 833e9752..0a05d91f 100755 --- a/marathon_lb.py +++ b/marathon_lb.py @@ -1691,10 +1691,10 @@ def get_apps(marathon, apps=[]): for task in new['tasks']: if 'healthCheckResults' not in task: continue - alive = True + alive = False for result in task['healthCheckResults']: - if not result['alive']: - alive = False + if result['alive']: + alive = True if alive: healthy_new_instances += 1 else: @@ -1802,15 +1802,15 @@ def get_apps(marathon, apps=[]): if marathon.health_check() and 'healthChecks' in app and \ len(app['healthChecks']) > 0: - alive = True + alive = False if 'healthCheckResults' not in task: # use previously cached result, if it exists if not healthCheckResultCache.get(task['id'], False): continue else: for result in task['healthCheckResults']: - if not result['alive']: - alive = False + if result['alive']: + alive = True healthCheckResultCache.set(task['id'], alive) if not alive: continue