Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Validate service operation prior to running
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jpignata committed Jan 12, 2018
1 parent 4300a71 commit 62a76fb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/service_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down Expand Up @@ -72,6 +72,8 @@ At least one of --cpu or --memory must be specified.`,
Memory: flagServiceUpdateMemory,
}

operation.Validate()

updateService(operation)
},
}
Expand All @@ -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)
}

0 comments on commit 62a76fb

Please sign in to comment.