From 478f296fb345ce9edc707aa4bcd588f8ffd55bb8 Mon Sep 17 00:00:00 2001 From: theunrealgeek Date: Sat, 23 May 2020 20:47:30 -0700 Subject: Modify PlayKubeReport to preserve pod->container mapping Signed-off-by: Aditya Kamath --- cmd/podman/play/kube.go | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'cmd/podman') diff --git a/cmd/podman/play/kube.go b/cmd/podman/play/kube.go index d2cfe8d43..17f3b430d 100644 --- a/cmd/podman/play/kube.go +++ b/cmd/podman/play/kube.go @@ -92,8 +92,10 @@ func kube(cmd *cobra.Command, args []string) error { return err } - for _, l := range report.Logs { - fmt.Fprintf(os.Stderr, l) + for _, pod := range report.Pods { + for _, l := range pod.Logs { + fmt.Fprintf(os.Stderr, l) + } } switch len(report.Pods) { @@ -105,19 +107,19 @@ func kube(cmd *cobra.Command, args []string) error { fmt.Printf("Pods:\n") } for _, pod := range report.Pods { - fmt.Println(pod) - } - - switch len(report.Containers) { - case 0: - return nil - case 1: - fmt.Printf("Container:\n") - default: - fmt.Printf("Containers:\n") - } - for _, ctr := range report.Containers { - fmt.Println(ctr) + fmt.Println(pod.ID) + + switch len(pod.Containers) { + case 0: + return nil + case 1: + fmt.Printf("Container:\n") + default: + fmt.Printf("Containers:\n") + } + for _, ctr := range pod.Containers { + fmt.Println(ctr) + } } return nil -- cgit v1.2.3-54-g00ecf