Skip to content

Commit

Permalink
Fix Fargate ECS task list
Browse files Browse the repository at this point in the history
  • Loading branch information
daaru00 committed Apr 8, 2022
1 parent ac45ebe commit b8c0505
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/ecs/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,14 @@ func ListTasks(c *cli.Context) error {
)
var options []string
for _, task := range tasks {
instance := "-"
if task.ContainerInstance != nil {
instance = *task.ContainerInstance.Ec2InstanceId
}
options = append(options, fmt.Sprintf(
"%-35s\t%-8s\t%-8s\t%-8s\t%s",
*task.TaskDefinition.Family, strconv.FormatInt(*task.TaskDefinition.Revision, 10),
*task.Status, *task.HealthStatus, *task.ContainerInstance.Ec2InstanceId,
*task.Status, *task.HealthStatus, instance,
))
}

Expand Down Expand Up @@ -320,7 +324,9 @@ func ListTasks(c *cli.Context) error {

// Set task and instance
c.Set("task", *tasks[taskSelectedIndex].Arn)
c.Set("instance", *tasks[taskSelectedIndex].ContainerInstance.Ec2InstanceId)
if tasks[taskSelectedIndex].ContainerInstance != nil {
c.Set("instance", *tasks[taskSelectedIndex].ContainerInstance.Ec2InstanceId)
}
return nil
}

Expand Down

0 comments on commit b8c0505

Please sign in to comment.