From f03c94698767d79a0b2a8c2866e838f9478dbdc4 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Mon, 8 Jan 2018 10:01:46 -0700 Subject: [PATCH] Only go to initializing if there are no conditions --- status/status.go | 50 ++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/status/status.go b/status/status.go index 53115994..77f05a1c 100644 --- a/status/status.go +++ b/status/status.go @@ -129,38 +129,38 @@ func Set(data map[string]interface{}) { } if state == "" { + val, ok := values.GetValue(data, "spec", "active") + if ok { + if convert.ToBool(val) { + state = "active" + } else { + state = "inactive" + } + } + } + + if state == "" { + val, _ := values.GetValueN(data, "status", "phase").(string) + if val != "" { + state = val + } + } + + if state == "" && len(conditions) == 0 { if val, ok := values.GetValue(data, "metadata", "created"); ok { if i, err := convert.ToTimestamp(val); err == nil { if time.Unix(i/1000, 0).Add(5 * time.Second).Before(time.Now()) { - if state == "" { - val, _ := values.GetValueN(data, "status", "phase").(string) - if val != "" { - state = val - } - } - - if state == "" { - val, ok := values.GetValue(data, "spec", "active") - if ok { - if convert.ToBool(val) { - state = "active" - } else { - state = "inactive" - } - } - } - - if state == "" { - state = "active" - } + state = "active" + } else { + state = "initializing" + transitioning = true } } } + } - if state == "" { - state = "initializing" - transitioning = true - } + if state == "" { + state = "active" } data["state"] = strings.ToLower(state)