From ca59eaf1a43e1bf754d0301f5a9534917149aaae Mon Sep 17 00:00:00 2001 From: Crazykev Date: Wed, 26 Oct 2016 19:32:59 +0800 Subject: [PATCH] display container metadata on the client for container list and status Signed-off-by: Crazykev --- cmd/client/container.go | 17 +++++++++++++++++ cmd/client/sandbox.go | 1 + 2 files changed, 18 insertions(+) diff --git a/cmd/client/container.go b/cmd/client/container.go index ac10c570..a738195a 100644 --- a/cmd/client/container.go +++ b/cmd/client/container.go @@ -364,6 +364,14 @@ func ContainerStatus(client pb.RuntimeServiceClient, ID string) error { return err } fmt.Printf("ID: %s\n", *r.Status.Id) + if r.Status.Metadata != nil { + if r.Status.Metadata.Name != nil { + fmt.Printf("Name: %s\n", *r.Status.Metadata.Name) + } + if r.Status.Metadata.Attempt != nil { + fmt.Printf("Attempt: %v\n", *r.Status.Metadata.Attempt) + } + } if r.Status.State != nil { fmt.Printf("Status: %s\n", r.Status.State) } @@ -428,6 +436,14 @@ func ListContainers(client pb.RuntimeServiceClient, opts listOptions) error { } fmt.Printf("ID: %s\n", *c.Id) fmt.Printf("Pod: %s\n", *c.PodSandboxId) + if c.Metadata != nil { + if c.Metadata.Name != nil { + fmt.Printf("Name: %s\n", *c.Metadata.Name) + } + if c.Metadata.Attempt != nil { + fmt.Printf("Attempt: %v\n", *c.Metadata.Attempt) + } + } if c.State != nil { fmt.Printf("Status: %s\n", *c.State) } @@ -447,6 +463,7 @@ func ListContainers(client pb.RuntimeServiceClient, opts listOptions) error { fmt.Printf("\t%s -> %s\n", k, v) } } + fmt.Println() } return nil } diff --git a/cmd/client/sandbox.go b/cmd/client/sandbox.go index 7722a2b7..feef50d5 100644 --- a/cmd/client/sandbox.go +++ b/cmd/client/sandbox.go @@ -379,6 +379,7 @@ func ListPodSandboxes(client pb.RuntimeServiceClient, opts listOptions) error { fmt.Printf("\t%s -> %s\n", k, v) } } + fmt.Println() } return nil }