Skip to content

Commit

Permalink
Add more info for ECS task/container
Browse files Browse the repository at this point in the history
  • Loading branch information
daaru00 committed May 2, 2023
1 parent 191e50b commit eab6d02
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
dist/*
cmd/ssm-run/ssm-run
cmd/ssm-session/ssm-session
bb-aws-connect
10 changes: 6 additions & 4 deletions cmd/ecs/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,15 @@ func ListTasks(c *cli.Context) error {
header := fmt.Sprintf(
"%-35s\t%-8s\t%-8s\t%-8s\t%s",
"Task Definition Family", "Revision",
"Status", "Health", "Instance ID",
"Status", "Health", "Instance ID / ARN",
)
var options []string
for _, task := range tasks {
instance := "-"
if task.ContainerInstance != nil {
instance = *task.ContainerInstance.Ec2InstanceId
} else {
instance = *task.Arn
}
options = append(options, fmt.Sprintf(
"%-35s\t%-8s\t%-8s\t%-8s\t%s",
Expand Down Expand Up @@ -383,14 +385,14 @@ func ListContainer(c *cli.Context) error {

// Build table
header := fmt.Sprintf(
"%-35s\t%-12s\t%8s\t%s",
"%-35s\t%-40s\t%8s\t%s",
"Container Name", "Container ID", "Status", "Image",
)
var options []string
for _, container := range containers {
options = append(options, fmt.Sprintf(
"%-35s\t%-12s\t%8s\t%s",
*container.Name, string(*container.RuntimeId)[0:12], *container.LastStatus, *container.Image,
"%-35s\t%-40s\t%8s\t%s",
*container.Name, *container.RuntimeId, *container.LastStatus, *container.Image,
))
}

Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"errors"
"fmt"
"log"
"os"

"github.com/bitbull-team/bb-aws-connect/cmd/ecs"
Expand Down Expand Up @@ -101,7 +102,6 @@ func main() {

err := app.Run(os.Args)
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(1)
log.Fatalf("ERROR: %s", err.Error())
}
}

0 comments on commit eab6d02

Please sign in to comment.