summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/build.go2
-rw-r--r--cmd/podman/commands.go3
-rw-r--r--cmd/podman/containers_prune.go2
-rw-r--r--cmd/podman/exists.go2
-rw-r--r--cmd/podman/export.go2
-rw-r--r--cmd/podman/history.go2
-rw-r--r--cmd/podman/imagefilters/filters.go2
-rw-r--r--cmd/podman/images.go2
-rw-r--r--cmd/podman/images_prune.go2
-rw-r--r--cmd/podman/import.go2
-rw-r--r--cmd/podman/info.go2
-rw-r--r--cmd/podman/inspect.go2
-rw-r--r--cmd/podman/load.go2
-rw-r--r--cmd/podman/pod.go3
-rw-r--r--cmd/podman/pod_inspect.go2
-rw-r--r--cmd/podman/pod_kill.go40
-rw-r--r--cmd/podman/pod_rm.go2
-rw-r--r--cmd/podman/pod_start.go42
-rw-r--r--cmd/podman/pod_stop.go47
-rw-r--r--cmd/podman/pull.go2
-rw-r--r--cmd/podman/push.go2
-rw-r--r--cmd/podman/rmi.go2
-rw-r--r--cmd/podman/save.go7
-rw-r--r--cmd/podman/system_prune.go2
-rw-r--r--cmd/podman/tag.go2
-rw-r--r--cmd/podman/volume_create.go2
-rw-r--r--cmd/podman/volume_inspect.go2
-rw-r--r--cmd/podman/volume_ls.go2
-rw-r--r--cmd/podman/volume_prune.go2
-rw-r--r--cmd/podman/volume_rm.go2
30 files changed, 76 insertions, 114 deletions
diff --git a/cmd/podman/build.go b/cmd/podman/build.go
index bb252f171..34fe6a012 100644
--- a/cmd/podman/build.go
+++ b/cmd/podman/build.go
@@ -9,7 +9,7 @@ import (
"github.com/containers/buildah/imagebuildah"
buildahcli "github.com/containers/buildah/pkg/cli"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/docker/go-units"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
diff --git a/cmd/podman/commands.go b/cmd/podman/commands.go
index d8fc44c2f..310ec8378 100644
--- a/cmd/podman/commands.go
+++ b/cmd/podman/commands.go
@@ -94,13 +94,10 @@ func getContainerSubCommands() []*cobra.Command {
func getPodSubCommands() []*cobra.Command {
return []*cobra.Command{
_podCreateCommand,
- _podKillCommand,
_podPauseCommand,
_podPsCommand,
_podRestartCommand,
- _podStartCommand,
_podStatsCommand,
- _podStopCommand,
_podTopCommand,
_podUnpauseCommand,
}
diff --git a/cmd/podman/containers_prune.go b/cmd/podman/containers_prune.go
index bae578e1d..6e4960429 100644
--- a/cmd/podman/containers_prune.go
+++ b/cmd/podman/containers_prune.go
@@ -6,7 +6,7 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/shared"
"github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
diff --git a/cmd/podman/exists.go b/cmd/podman/exists.go
index aad203818..74a4c841b 100644
--- a/cmd/podman/exists.go
+++ b/cmd/podman/exists.go
@@ -6,8 +6,8 @@ import (
"os"
"github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/adapter"
"github.com/containers/libpod/libpod/image"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
)
diff --git a/cmd/podman/export.go b/cmd/podman/export.go
index a593a4753..5873bad3d 100644
--- a/cmd/podman/export.go
+++ b/cmd/podman/export.go
@@ -4,7 +4,7 @@ import (
"os"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/containers/libpod/pkg/rootless"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
diff --git a/cmd/podman/history.go b/cmd/podman/history.go
index 6791257d9..103ef08e8 100644
--- a/cmd/podman/history.go
+++ b/cmd/podman/history.go
@@ -8,8 +8,8 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/formats"
- "github.com/containers/libpod/libpod/adapter"
"github.com/containers/libpod/libpod/image"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/docker/go-units"
"github.com/pkg/errors"
"github.com/spf13/cobra"
diff --git a/cmd/podman/imagefilters/filters.go b/cmd/podman/imagefilters/filters.go
index 366510202..d01eb7436 100644
--- a/cmd/podman/imagefilters/filters.go
+++ b/cmd/podman/imagefilters/filters.go
@@ -5,7 +5,7 @@ import (
"strings"
"time"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/containers/libpod/pkg/inspect"
)
diff --git a/cmd/podman/images.go b/cmd/podman/images.go
index 56810eaeb..6e82195a9 100644
--- a/cmd/podman/images.go
+++ b/cmd/podman/images.go
@@ -11,8 +11,8 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/formats"
"github.com/containers/libpod/cmd/podman/imagefilters"
- "github.com/containers/libpod/libpod/adapter"
"github.com/containers/libpod/libpod/image"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/docker/go-units"
"github.com/opencontainers/go-digest"
"github.com/pkg/errors"
diff --git a/cmd/podman/images_prune.go b/cmd/podman/images_prune.go
index cc0dcb99a..79dcd097c 100644
--- a/cmd/podman/images_prune.go
+++ b/cmd/podman/images_prune.go
@@ -4,7 +4,7 @@ import (
"fmt"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/import.go b/cmd/podman/import.go
index 053408ff3..a64b03d6d 100644
--- a/cmd/podman/import.go
+++ b/cmd/podman/import.go
@@ -4,7 +4,7 @@ import (
"fmt"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/info.go b/cmd/podman/info.go
index 06dbbd748..a1473dac9 100644
--- a/cmd/podman/info.go
+++ b/cmd/podman/info.go
@@ -7,7 +7,7 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/formats"
"github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/containers/libpod/version"
"github.com/pkg/errors"
"github.com/spf13/cobra"
diff --git a/cmd/podman/inspect.go b/cmd/podman/inspect.go
index 48b953207..46883b31d 100644
--- a/cmd/podman/inspect.go
+++ b/cmd/podman/inspect.go
@@ -8,7 +8,7 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/formats"
"github.com/containers/libpod/cmd/podman/shared"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
cc "github.com/containers/libpod/pkg/spec"
"github.com/containers/libpod/pkg/util"
"github.com/pkg/errors"
diff --git a/cmd/podman/load.go b/cmd/podman/load.go
index 514c9f1e9..272cd78d2 100644
--- a/cmd/podman/load.go
+++ b/cmd/podman/load.go
@@ -7,7 +7,7 @@ import (
"os"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/pod.go b/cmd/podman/pod.go
index d65e0b384..4c7c416ce 100644
--- a/cmd/podman/pod.go
+++ b/cmd/podman/pod.go
@@ -22,7 +22,10 @@ var podCommand = cliconfig.PodmanCommand{
var podSubCommands = []*cobra.Command{
_podExistsCommand,
_podInspectCommand,
+ _podKillCommand,
_podRmCommand,
+ _podStartCommand,
+ _podStopCommand,
}
func init() {
diff --git a/cmd/podman/pod_inspect.go b/cmd/podman/pod_inspect.go
index 1f4d1a3dd..5a32b5c5d 100644
--- a/cmd/podman/pod_inspect.go
+++ b/cmd/podman/pod_inspect.go
@@ -5,7 +5,7 @@ import (
"fmt"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/pod_kill.go b/cmd/podman/pod_kill.go
index d0318b409..aaaae0f7d 100644
--- a/cmd/podman/pod_kill.go
+++ b/cmd/podman/pod_kill.go
@@ -5,7 +5,7 @@ import (
"syscall"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/cmd/podman/libpodruntime"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/docker/docker/pkg/signal"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -45,7 +45,7 @@ func init() {
// podKillCmd kills one or more pods with a signal
func podKillCmd(c *cliconfig.PodKillValues) error {
- runtime, err := libpodruntime.GetRuntime(&c.PodmanCommand)
+ runtime, err := adapter.GetRuntime(&c.PodmanCommand)
if err != nil {
return errors.Wrapf(err, "could not get runtime")
}
@@ -63,30 +63,20 @@ func podKillCmd(c *cliconfig.PodKillValues) error {
killSignal = uint(sysSignal)
}
- // 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)
+ podKillIds, podKillErrors := runtime.KillPods(getContext(), c, killSignal)
+ for _, p := range podKillIds {
+ fmt.Println(p)
+ }
+ if len(podKillErrors) == 0 {
+ return nil
+ }
+ // Grab the last error
+ lastError := podKillErrors[len(podKillErrors)-1]
+ // Remove the last error from the error slice
+ podKillErrors = podKillErrors[:len(podKillErrors)-1]
- for _, pod := range pods {
- ctr_errs, err := pod.Kill(killSignal)
- if ctr_errs != nil {
- for ctr, err := range ctr_errs {
- if lastError != nil {
- logrus.Errorf("%q", lastError)
- }
- lastError = errors.Wrapf(err, "unable to kill container %q in pod %q", ctr, pod.ID())
- }
- continue
- }
- if err != nil {
- if lastError != nil {
- logrus.Errorf("%q", lastError)
- }
- lastError = errors.Wrapf(err, "unable to kill pod %q", pod.ID())
- continue
- }
- fmt.Println(pod.ID())
+ for _, err := range podKillErrors {
+ logrus.Errorf("%q", err)
}
return lastError
}
diff --git a/cmd/podman/pod_rm.go b/cmd/podman/pod_rm.go
index b552b9f42..ba16d03c7 100644
--- a/cmd/podman/pod_rm.go
+++ b/cmd/podman/pod_rm.go
@@ -2,9 +2,9 @@ package main
import (
"fmt"
- "github.com/containers/libpod/libpod/adapter"
"github.com/containers/libpod/cmd/podman/cliconfig"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
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
}
diff --git a/cmd/podman/pod_stop.go b/cmd/podman/pod_stop.go
index 52c92b521..62d0d4aa5 100644
--- a/cmd/podman/pod_stop.go
+++ b/cmd/podman/pod_stop.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"
@@ -47,43 +47,26 @@ func init() {
}
func podStopCmd(c *cliconfig.PodStopValues) error {
- timeout := -1
- 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()
-
- if c.Flag("timeout").Changed {
- timeout = int(c.Timeout)
+ podStopIds, podStopErrors := runtime.StopPods(getContext(), c)
+ for _, p := range podStopIds {
+ fmt.Println(p)
}
- for _, pod := range pods {
- // set cleanup to true to clean mounts and namespaces
- ctr_errs, err := pod.StopWithTimeout(ctx, true, timeout)
- if ctr_errs != nil {
- for ctr, err := range ctr_errs {
- if lastError != nil {
- logrus.Errorf("%q", lastError)
- }
- lastError = errors.Wrapf(err, "unable to stop 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 stop pod %q", pod.ID())
- continue
- }
- fmt.Println(pod.ID())
+ if len(podStopErrors) == 0 {
+ return nil
+ }
+ // Grab the last error
+ lastError := podStopErrors[len(podStopErrors)-1]
+ // Remove the last error from the error slice
+ podStopErrors = podStopErrors[:len(podStopErrors)-1]
+
+ for _, err := range podStopErrors {
+ logrus.Errorf("%q", err)
}
return lastError
}
diff --git a/cmd/podman/pull.go b/cmd/podman/pull.go
index 476bccb0e..71f555162 100644
--- a/cmd/podman/pull.go
+++ b/cmd/podman/pull.go
@@ -11,9 +11,9 @@ import (
"github.com/containers/image/transports/alltransports"
"github.com/containers/image/types"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod/adapter"
"github.com/containers/libpod/libpod/common"
image2 "github.com/containers/libpod/libpod/image"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/containers/libpod/pkg/util"
opentracing "github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
diff --git a/cmd/podman/push.go b/cmd/podman/push.go
index 881d8cebc..56261a8d3 100644
--- a/cmd/podman/push.go
+++ b/cmd/podman/push.go
@@ -10,8 +10,8 @@ import (
"github.com/containers/image/manifest"
"github.com/containers/image/types"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod/adapter"
"github.com/containers/libpod/libpod/image"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/containers/libpod/pkg/util"
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
diff --git a/cmd/podman/rmi.go b/cmd/podman/rmi.go
index fb27772f5..fbaa19336 100644
--- a/cmd/podman/rmi.go
+++ b/cmd/podman/rmi.go
@@ -5,7 +5,7 @@ import (
"os"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/containers/storage"
"github.com/pkg/errors"
"github.com/spf13/cobra"
diff --git a/cmd/podman/save.go b/cmd/podman/save.go
index ab421add6..161540deb 100644
--- a/cmd/podman/save.go
+++ b/cmd/podman/save.go
@@ -1,14 +1,15 @@
package main
import (
+ "os"
+ "strings"
+
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/containers/libpod/pkg/util"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
- "os"
- "strings"
)
const (
diff --git a/cmd/podman/system_prune.go b/cmd/podman/system_prune.go
index a91d7bf0a..a823dcad1 100644
--- a/cmd/podman/system_prune.go
+++ b/cmd/podman/system_prune.go
@@ -8,7 +8,7 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/shared"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
diff --git a/cmd/podman/tag.go b/cmd/podman/tag.go
index 422e9dbf6..2b9d67066 100644
--- a/cmd/podman/tag.go
+++ b/cmd/podman/tag.go
@@ -2,7 +2,7 @@ package main
import (
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/volume_create.go b/cmd/podman/volume_create.go
index 6c8a78922..833191082 100644
--- a/cmd/podman/volume_create.go
+++ b/cmd/podman/volume_create.go
@@ -4,7 +4,7 @@ import (
"fmt"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/volume_inspect.go b/cmd/podman/volume_inspect.go
index 3b4ba51d5..dc6afbc36 100644
--- a/cmd/podman/volume_inspect.go
+++ b/cmd/podman/volume_inspect.go
@@ -2,7 +2,7 @@ package main
import (
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/volume_ls.go b/cmd/podman/volume_ls.go
index 0edadc5ac..5adfc1e91 100644
--- a/cmd/podman/volume_ls.go
+++ b/cmd/podman/volume_ls.go
@@ -6,7 +6,7 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/formats"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/volume_prune.go b/cmd/podman/volume_prune.go
index a2205140f..1f7931aa4 100644
--- a/cmd/podman/volume_prune.go
+++ b/cmd/podman/volume_prune.go
@@ -8,7 +8,7 @@ import (
"strings"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
diff --git a/cmd/podman/volume_rm.go b/cmd/podman/volume_rm.go
index 14847a949..03b6ccae1 100644
--- a/cmd/podman/volume_rm.go
+++ b/cmd/podman/volume_rm.go
@@ -4,7 +4,7 @@ import (
"fmt"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/libpod/adapter"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)