summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorhaircommander <pehunt@redhat.com>2018-07-23 09:13:45 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-23 14:22:07 +0000
commit8f48e60840123825d88fd5f50f435f9615cc2948 (patch)
treef1f773f38a39f2ba4a3c6cf2ecba8d30137ad703 /cmd/podman
parentacd28b9fc9379df68ad6f5a0e389ec73cfec15ef (diff)
downloadpodman-8f48e60840123825d88fd5f50f435f9615cc2948.tar.gz
podman-8f48e60840123825d88fd5f50f435f9615cc2948.tar.bz2
podman-8f48e60840123825d88fd5f50f435f9615cc2948.zip
Fix error handling in pod start/stop.
Before, errors in containers would never be printed, and a generic error would only be shown. Signed-off-by: haircommander <pehunt@redhat.com> Closes: #1132 Approved by: mheon
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/pod_start.go15
-rw-r--r--cmd/podman/pod_stop.go15
2 files changed, 16 insertions, 14 deletions
diff --git a/cmd/podman/pod_start.go b/cmd/podman/pod_start.go
index 1e82bc0ee..75681a747 100644
--- a/cmd/podman/pod_start.go
+++ b/cmd/podman/pod_start.go
@@ -78,13 +78,7 @@ func podStartCmd(c *cli.Context) error {
ctx := getContext()
for _, pod := range pods {
ctr_errs, err := pod.Start(ctx)
- if err != nil {
- if lastError != nil {
- logrus.Errorf("%q", lastError)
- }
- lastError = errors.Wrapf(err, "unable to start pod %q", pod.ID())
- continue
- } else if ctr_errs != nil {
+ if ctr_errs != nil {
for ctr, err := range ctr_errs {
if lastError != nil {
logrus.Errorf("%q", lastError)
@@ -93,6 +87,13 @@ func podStartCmd(c *cli.Context) error {
}
continue
}
+ if err != nil {
+ if lastError != nil {
+ logrus.Errorf("%q", lastError)
+ }
+ lastError = errors.Wrapf(err, "unable to start pod %q", pod.ID())
+ continue
+ }
fmt.Println(pod.ID())
}
diff --git a/cmd/podman/pod_stop.go b/cmd/podman/pod_stop.go
index 0dcbdaad6..57ef458f1 100644
--- a/cmd/podman/pod_stop.go
+++ b/cmd/podman/pod_stop.go
@@ -79,13 +79,7 @@ func podStopCmd(c *cli.Context) error {
for _, pod := range pods {
// set cleanup to true to clean mounts and namespaces
ctr_errs, err := pod.Stop(true)
- if err != nil {
- if lastError != nil {
- logrus.Errorf("%q", lastError)
- }
- lastError = errors.Wrapf(err, "unable to stop pod %q", pod.ID())
- continue
- } else if ctr_errs != nil {
+ if ctr_errs != nil {
for ctr, err := range ctr_errs {
if lastError != nil {
logrus.Errorf("%q", lastError)
@@ -94,6 +88,13 @@ func podStopCmd(c *cli.Context) error {
}
continue
}
+ if err != nil {
+ if lastError != nil {
+ logrus.Errorf("%q", lastError)
+ }
+ lastError = errors.Wrapf(err, "unable to stop pod %q", pod.ID())
+ continue
+ }
fmt.Println(pod.ID())
}
return lastError