summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-01-11 17:06:49 -0500
committerGitHub <noreply@github.com>2021-01-11 17:06:49 -0500
commit63d8f535ec93b5e83257e39b9d656747c4bedfcc (patch)
treea927d255621be74269f9406466f9f1b3b6adfe35 /cmd
parent20217f578941a207fadac92535f4b56bca99e424 (diff)
parent7e3fb33be85122d509756e197aac10c4cf9930b6 (diff)
downloadpodman-63d8f535ec93b5e83257e39b9d656747c4bedfcc.tar.gz
podman-63d8f535ec93b5e83257e39b9d656747c4bedfcc.tar.bz2
podman-63d8f535ec93b5e83257e39b9d656747c4bedfcc.zip
Merge pull request #8917 from mheon/actually_report_play_kube_errors
Ensure that `podman play kube` actually reports errors
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/play/kube.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/cmd/podman/play/kube.go b/cmd/podman/play/kube.go
index db7280b1d..1f54db203 100644
--- a/cmd/podman/play/kube.go
+++ b/cmd/podman/play/kube.go
@@ -12,6 +12,7 @@ import (
"github.com/containers/podman/v2/cmd/podman/utils"
"github.com/containers/podman/v2/pkg/domain/entities"
"github.com/containers/podman/v2/pkg/util"
+ "github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -130,6 +131,8 @@ func kube(cmd *cobra.Command, args []string) error {
}
}
+ ctrsFailed := 0
+
for _, pod := range report.Pods {
fmt.Printf("Pod:\n")
fmt.Println(pod.ID)
@@ -145,9 +148,21 @@ func kube(cmd *cobra.Command, args []string) error {
for _, ctr := range pod.Containers {
fmt.Println(ctr)
}
+ ctrsFailed += len(pod.ContainerErrors)
+ // If We have errors, add a newline
+ if len(pod.ContainerErrors) > 0 {
+ fmt.Println()
+ }
+ for _, err := range pod.ContainerErrors {
+ fmt.Fprintf(os.Stderr, err+"\n")
+ }
// Empty line for space for next block
fmt.Println()
}
+ if ctrsFailed > 0 {
+ return errors.Errorf("failed to start %d containers", ctrsFailed)
+ }
+
return nil
}