Remove bundles from API
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
1dc5d652ac
commit
ab8586b7c5
48 changed files with 3287 additions and 5946 deletions
|
@ -3,6 +3,8 @@ package main
|
|||
import (
|
||||
gocontext "context"
|
||||
"fmt"
|
||||
"os"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/docker/containerd/api/services/execution"
|
||||
"github.com/urfave/cli"
|
||||
|
@ -12,29 +14,27 @@ var listCommand = cli.Command{
|
|||
Name: "list",
|
||||
Usage: "list containers",
|
||||
Action: func(context *cli.Context) error {
|
||||
executionService, err := getExecutionService(context)
|
||||
containers, err := getExecutionService(context)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
listResponse, err := executionService.ListContainers(gocontext.Background(), &execution.ListContainersRequest{
|
||||
Owner: []string{},
|
||||
})
|
||||
response, err := containers.List(gocontext.Background(), &execution.ListRequest{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println("ID\tSTATUS\tPROCS\tBUNDLE")
|
||||
for _, c := range listResponse.Containers {
|
||||
listProcResponse, err := executionService.ListProcesses(gocontext.Background(),
|
||||
&execution.ListProcessesRequest{ContainerID: c.ID})
|
||||
if err != nil {
|
||||
w := tabwriter.NewWriter(os.Stdout, 10, 1, 3, ' ', 0)
|
||||
fmt.Fprintln(w, "ID\tPID\tSTATUS")
|
||||
for _, c := range response.Containers {
|
||||
if _, err := fmt.Fprintf(w, "%s\t%s\t%s\n",
|
||||
c.ID,
|
||||
c.Pid,
|
||||
c.Status.String(),
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := w.Flush(); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("%s\t%s\t%d\t%s\n",
|
||||
c.ID,
|
||||
c.State,
|
||||
len(listProcResponse.Processes),
|
||||
c.Bundle,
|
||||
)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue