summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/commands.go2
-rw-r--r--cmd/podman/main.go1
-rw-r--r--cmd/podman/pod.go6
-rw-r--r--cmd/podman/pod_rm.go38
-rw-r--r--cmd/podman/varlink/io.podman.varlink2
5 files changed, 25 insertions, 24 deletions
diff --git a/cmd/podman/commands.go b/cmd/podman/commands.go
index 387e35767..466ffa22f 100644
--- a/cmd/podman/commands.go
+++ b/cmd/podman/commands.go
@@ -15,7 +15,6 @@ func getMainCommands() []*cobra.Command {
_diffCommand,
_execCommand,
generateCommand.Command,
- podCommand.Command,
_containerKubeCommand,
_psCommand,
_loadCommand,
@@ -100,7 +99,6 @@ func getPodSubCommands() []*cobra.Command {
_podPauseCommand,
_podPsCommand,
_podRestartCommand,
- _podRmCommand,
_podStartCommand,
_podStatsCommand,
_podStopCommand,
diff --git a/cmd/podman/main.go b/cmd/podman/main.go
index 5fa6cf233..b60f3e1e1 100644
--- a/cmd/podman/main.go
+++ b/cmd/podman/main.go
@@ -45,6 +45,7 @@ var mainCommands = []*cobra.Command{
_infoCommand,
_inspectCommand,
_killCommand,
+ podCommand.Command,
_pullCommand,
_pushCommand,
_rmiCommand,
diff --git a/cmd/podman/pod.go b/cmd/podman/pod.go
index e988875ab..cf87730d7 100644
--- a/cmd/podman/pod.go
+++ b/cmd/podman/pod.go
@@ -18,7 +18,13 @@ var podCommand = cliconfig.PodmanCommand{
},
}
+//podSubCommands are implemented both in local and remote clients
+var podSubCommands = []*cobra.Command{
+ _podRmCommand,
+}
+
func init() {
+ podCommand.AddCommand(podSubCommands...)
podCommand.AddCommand(getPodSubCommands()...)
podCommand.SetUsageTemplate(UsageTemplate())
}
diff --git a/cmd/podman/pod_rm.go b/cmd/podman/pod_rm.go
index 54cee2a50..b615f88c9 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/cmd/podman/libpodruntime"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@@ -42,36 +42,30 @@ func init() {
}
-// saveCmd saves the image to either docker-archive or oci
+// podRmCmd deletes pods
func podRmCmd(c *cliconfig.PodRmValues) error {
if err := checkMutuallyExclusiveFlags(&c.PodmanCommand); err != nil {
return err
}
-
- 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)
+ podRmIds, podRmErrors := runtime.RemovePods(getContext(), c)
+ for _, p := range podRmIds {
+ fmt.Println(p)
+ }
+ if len(podRmErrors) == 0 {
+ return nil
+ }
+ // Grab the last error
+ lastError := podRmErrors[len(podRmErrors)-1]
+ // Remove the last error from the error slice
+ podRmErrors = podRmErrors[:len(podRmErrors)-1]
- ctx := getContext()
- force := c.Force
-
- // 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)
-
- for _, pod := range pods {
- err = runtime.RemovePod(ctx, pod, force, force)
- if err != nil {
- if lastError != nil {
- logrus.Errorf("%q", lastError)
- }
- lastError = errors.Wrapf(err, "failed to delete pod %v", pod.ID())
- } else {
- fmt.Println(pod.ID())
- }
+ for _, err := range podRmErrors {
+ logrus.Errorf("%q", err)
}
return lastError
}
diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink
index cae77e5b3..53c21cb21 100644
--- a/cmd/podman/varlink/io.podman.varlink
+++ b/cmd/podman/varlink/io.podman.varlink
@@ -1102,6 +1102,8 @@ method VolumesPrune() -> (prunedNames: []string, prunedErrors: []string)
method ImageSave(options: ImageSaveOptions) -> (reply: MoreResponse)
+method GetPodsByContext(all: bool, latest: bool, args: []string) -> (pods: []string)
+
# ImageNotFound means the image could not be found by the provided name or ID in local storage.
error ImageNotFound (id: string)