Skip to content

Commit

Permalink
resolve defect with exec commands with args in service
Browse files Browse the repository at this point in the history
  • Loading branch information
cplee committed Jul 28, 2017
1 parent dd5636a commit df8dac7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cli/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func newTask(c *cli.Context) (*common.Task, error) {
return nil, err
}
environmentName := c.Args().First()
command := strings.Join(c.Args()[ExeArgsCmdIndex:], Space)
command := c.Args()[ExeArgsCmdIndex:]
return &common.Task{
Environment: environmentName,
Command: command,
Expand Down
2 changes: 1 addition & 1 deletion common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ type Task struct {
Service string
TaskDefinition string
Cluster string
Command string
Command []string
Containers []Container
}

Expand Down
11 changes: 7 additions & 4 deletions provider/aws/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,20 @@ func (taskMgr *ecsTaskManager) getTaskRunInput(task common.Task) (*ecs.RunTaskIn
ecsServiceName := ecsStack.Parameters[ECSServiceNameParameterKey]
log.Debugf(ExecuteECSInputParameterLog, task.Environment, ecsServiceName, ecsCluster, ecsTaskDefinition)

command := make([]*string, len(task.Command))
for i, commandPart := range task.Command {
command[i] = aws.String(strings.TrimSpace(commandPart))
}

ecsRunTaskInput := &ecs.RunTaskInput{
Cluster: aws.String(ecsCluster),
TaskDefinition: aws.String(ecsTaskDefinition),
Count: aws.Int64(1),
Overrides: &ecs.TaskOverride{
ContainerOverrides: []*ecs.ContainerOverride{
{
Name: aws.String(ecsServiceName),
Command: []*string{
aws.String(strings.TrimSpace(task.Command)),
},
Name: aws.String(ecsServiceName),
Command: command,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion provider/aws/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,6 @@ func getTestTask() common.Task {
return common.Task{
Environment: TestEnv,
Service: TestSvc,
Command: TestCmd,
Command: []string{TestCmd},
}
}
4 changes: 2 additions & 2 deletions workflows/service_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestNewServiceExecutorFail(t *testing.T) {
task := common.Task{
Environment: TestEnv,
Service: TestSvc,
Command: TestCmd,
Command: []string{TestCmd},
}
executor := newServiceExecutor(taskManagerMock, task)
assertion.NotNil(executor)
Expand All @@ -60,7 +60,7 @@ func TestNewServiceExecutor(t *testing.T) {
task := common.Task{
Environment: TestEnv,
Service: TestSvc,
Command: TestCmd,
Command: []string{TestCmd},
}
executor := newServiceExecutor(taskManagerMock, task)
assertion.NotNil(executor)
Expand Down

0 comments on commit df8dac7

Please sign in to comment.