From 10b7c4ea176d0d82049e7ff58ab55de3f1cf718c Mon Sep 17 00:00:00 2001 From: bay1ts Date: Mon, 11 Dec 2017 09:47:47 +0800 Subject: [PATCH] =?UTF-8?q?[REV]=20optimize=20grctl=20task=20depends=20com?= =?UTF-8?q?mand=EF=BC=9Boptimize=20install=20process?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/grctl/cmd/installStatus.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/pkg/grctl/cmd/installStatus.go b/pkg/grctl/cmd/installStatus.go index 7f930229f..44fd0da37 100644 --- a/pkg/grctl/cmd/installStatus.go +++ b/pkg/grctl/cmd/installStatus.go @@ -200,6 +200,8 @@ func Status(task string,nodes []string) { for _, v := range nodes { set[v] = true } + fmt.Printf("%s task is start\n",task) + lastState="Start" for checkFail<3 { time.Sleep(3*time.Second) taskE,err:=clients.NodeClient.Tasks().Get(task) @@ -217,10 +219,9 @@ func Status(task string,nodes []string) { for k,v:=range status.Status{ //不是当前任务需要检测的status if !set[k] { - logrus.Infof("task %s can't run in %s",task,k) + fmt.Print("..") continue } - logrus.Infof("task %s status is %v,final status is %s",task,v.Status,v.CompleStatus) if strings.Contains(v.Status, "error")||strings.Contains(v.CompleStatus,"Failure")||strings.Contains(v.CompleStatus,"Unknow") { checkFail+=1 fmt.Errorf("error executing task %s",task) @@ -238,6 +239,12 @@ func Status(task string,nodes []string) { } os.Exit(1) } + if lastState!=v.Status{ + fmt.Printf("task %s is %s\n",task,v.Status) + }else{ + fmt.Print("..") + } + lastState=v.Status if v.Status=="complete"||v.CompleStatus=="Success"{ fmt.Printf("task %s is %s %s\n",task,v.Status,v.CompleStatus) lastState=v.Status @@ -270,14 +277,6 @@ func Status(task string,nodes []string) { } } return - }else{ - logrus.Infof("latest state is %s ,now task status is %s",lastState,v.Status) - if lastState!=v.Status{ - fmt.Printf("task %s is %s\n",task,v.Status) - }else{ - fmt.Print("..") - } - lastState=v.Status } }