summaryrefslogtreecommitdiff
path: root/cmd/podman/pod_start.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-02-24 03:13:25 +0100
committerGitHub <noreply@github.com>2019-02-24 03:13:25 +0100
commitcc4adddeb77ef38ecd36be04e95685b2e7b8b86c (patch)
tree9dffece816ad32c2c0b7651cb7c88be70954a88f /cmd/podman/pod_start.go
parent8e4be923b83aadfaa58569326119890ed9c1d459 (diff)
parent4bf973a9f61eae3b02925a42ccfa784baeb917dc (diff)
downloadpodman-cc4adddeb77ef38ecd36be04e95685b2e7b8b86c.tar.gz
podman-cc4adddeb77ef38ecd36be04e95685b2e7b8b86c.tar.bz2
podman-cc4adddeb77ef38ecd36be04e95685b2e7b8b86c.zip
Merge pull request #2413 from baude/remotepodstop
Enable more podman-remote pod commands
Diffstat (limited to 'cmd/podman/pod_start.go')
-rw-r--r--cmd/podman/pod_start.go42
1 files changed, 15 insertions, 27 deletions
diff --git a/cmd/podman/pod_start.go b/cmd/podman/pod_start.go
index 3bba5c2e9..5761afd52 100644
--- a/cmd/podman/pod_start.go
+++ b/cmd/podman/pod_start.go
@@ -4,7 +4,7 @@ import (
"fmt"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/cmd/podman/libpodruntime"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@@ -45,38 +45,26 @@ func init() {
}
func podStartCmd(c *cliconfig.PodStartValues) error {
- runtime, err := libpodruntime.GetRuntime(&c.PodmanCommand)
+ runtime, err := adapter.GetRuntime(&c.PodmanCommand)
if err != nil {
return errors.Wrapf(err, "could not get runtime")
}
defer runtime.Shutdown(false)
- // getPodsFromContext returns an error when a requested pod
- // isn't found. The only fatal error scenerio is when there are no pods
- // in which case the following loop will be skipped.
- pods, lastError := getPodsFromContext(&c.PodmanCommand, runtime)
-
- ctx := getContext()
- for _, pod := range pods {
- ctr_errs, err := pod.Start(ctx)
- if ctr_errs != nil {
- for ctr, err := range ctr_errs {
- if lastError != nil {
- logrus.Errorf("%q", lastError)
- }
- lastError = errors.Wrapf(err, "unable to start container %q on pod %q", ctr, pod.ID())
- }
- 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())
+ podStartIDs, podStartErrors := runtime.StartPods(getContext(), c)
+ for _, p := range podStartIDs {
+ fmt.Println(p)
+ }
+ if len(podStartErrors) == 0 {
+ return nil
}
+ // Grab the last error
+ lastError := podStartErrors[len(podStartErrors)-1]
+ // Remove the last error from the error slice
+ podStartErrors = podStartErrors[:len(podStartErrors)-1]
+ for _, err := range podStartErrors {
+ logrus.Errorf("%q", err)
+ }
return lastError
}