From 6a184933d125861814842ce4cb680d083a39266a Mon Sep 17 00:00:00 2001 From: Mayuresh Gaitonde Date: Tue, 20 Nov 2018 18:16:44 -0800 Subject: [PATCH] Fix consul helthcheck --- controller/consul.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/controller/consul.go b/controller/consul.go index e67dba6..b09822d 100644 --- a/controller/consul.go +++ b/controller/consul.go @@ -110,8 +110,13 @@ func (c *ConsulMon) healthCheck(service string) (bool, error) { } for _, nodeInfo := range data { n := nodeInfo.(map[string]interface{}) - if n["Node"] == c.node && n["Status"].(string) == "passing" { - return true, nil + if n["Node"] == c.node { + if n["Status"].(string) == "passing" { + return true, nil + } else { + glog.V(2).Infof("Consul Healthcheck returned %s status", n["Status"].(string)) + return false, nil + } } } return false, fmt.Errorf("No healcheck info found for node %s in consul", c.node)