From 62a76fb6a2e74fb7b605bb5fee29dda0a1097712 Mon Sep 17 00:00:00 2001 From: John Pignata Date: Thu, 11 Jan 2018 19:04:48 -0500 Subject: [PATCH] Validate service operation prior to running Looks like this was dropped in the last refactoring. Next step is to separate out the command layer from the operation layer and to properly test both. For now I'm releasing a hotfix. - Fix display of CPU units and MiB in confirmation message --- cmd/service_update.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/service_update.go b/cmd/service_update.go index 94c574a..701840e 100644 --- a/cmd/service_update.go +++ b/cmd/service_update.go @@ -36,7 +36,7 @@ func (o *ServiceUpdateOperation) Validate() { err := validateCpuAndMemory(o.Cpu, o.Memory) if err != nil { - console.ErrorExit(err, "Invalid settings: %d CPU units / %d MiB", o.Cpu, o.Memory) + console.ErrorExit(err, "Invalid settings: %s CPU units / %s MiB", o.Cpu, o.Memory) } } @@ -72,6 +72,8 @@ At least one of --cpu or --memory must be specified.`, Memory: flagServiceUpdateMemory, } + operation.Validate() + updateService(operation) }, } @@ -93,5 +95,5 @@ func updateService(operation *ServiceUpdateOperation) { ) ecs.UpdateServiceTaskDefinition(operation.ServiceName, newTaskDefinitionArn) - console.Info("Updated service %s to %d CPU units / %d MiB", operation.ServiceName, operation.Cpu, operation.Memory) + console.Info("Updated service %s to %s CPU units / %s MiB", operation.ServiceName, operation.Cpu, operation.Memory) }