From c890b9a78a457b37e978b985dcf8f25799b8263e Mon Sep 17 00:00:00 2001 From: stormcat24 Date: Fri, 13 Nov 2015 17:03:06 +0900 Subject: [PATCH 1/2] fixed #38 --- service/service.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/service/service.go b/service/service.go index 6c6fd31..e576cb3 100644 --- a/service/service.go +++ b/service/service.go @@ -239,9 +239,10 @@ func (self *ServiceController) ApplyServicePlan(plan *ServiceUpdatePlan) error { var nextDesiredCount int64 if add.KeepDesiredCount { nextDesiredCount = *current.DesiredCount + logger.Main.Infof("Keep DesiredCount = %d at '%s'", nextDesiredCount, add.Name) } else { nextDesiredCount = add.DesiredCount - logger.Main.Infof("Keep DesiredCount = %d at '%s'", nextDesiredCount, add.Name) + logger.Main.Infof("Next DesiredCount = %d at '%s'", nextDesiredCount, add.Name) } svc, err := api.UpdateService(plan.Name, add.Name, nextDesiredCount, add.TaskDefinition) @@ -278,17 +279,20 @@ func (self *ServiceController) ApplyServicePlan(plan *ServiceUpdatePlan) error { } } - dts, err := api.DescribeTasks(plan.Name, taskIds) - if err != nil { - return err - } + if len(taskIds) > 0 { + dts, err := api.DescribeTasks(plan.Name, taskIds) + if err != nil { + return err + } - for _, t := range dts.Tasks { - if *t.StartedBy == targetServiceId { - if _, err := api.StopTask(plan.Name, *t.TaskArn); err != nil { - return err + for _, t := range dts.Tasks { + if *t.StartedBy == targetServiceId { + if _, err := api.StopTask(plan.Name, *t.TaskArn); err != nil { + logger.Main.Warnf("Task '%s' is not found, so cannot stop.", *t.TaskArn) + } else { + logger.Main.Infof("Stopped Task '%s'", *t.TaskArn) + } } - logger.Main.Infof("Stopped Task '%s'", *t.TaskArn) } } From 6d44868a1f2c14752ee65e6ee477003351492f7d Mon Sep 17 00:00:00 2001 From: stormcat24 Date: Fri, 13 Nov 2015 17:04:27 +0900 Subject: [PATCH 2/2] bump version --- operation/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operation/version.go b/operation/version.go index bee6fd4..a3f6bca 100644 --- a/operation/version.go +++ b/operation/version.go @@ -1,3 +1,3 @@ package operation -const Version string = "0.1.10" +const Version string = "0.1.11"