summaryrefslogtreecommitdiff
path: root/cmd/podman/pods_prune.go
diff options
context:
space:
mode:
authorPeter Hunt <pehunt@redhat.com>2019-04-15 15:44:32 -0400
committerPeter Hunt <pehunt@redhat.com>2019-04-16 11:23:18 -0400
commit4319552cf89e72925a80c63f427e5ef0a6376046 (patch)
tree5a0e38e63a41fdafe7f5d08daf496a0d68341aae /cmd/podman/pods_prune.go
parent0b34b4a59cf090a47a2a13cc4814954c497b3d49 (diff)
downloadpodman-4319552cf89e72925a80c63f427e5ef0a6376046.tar.gz
podman-4319552cf89e72925a80c63f427e5ef0a6376046.tar.bz2
podman-4319552cf89e72925a80c63f427e5ef0a6376046.zip
Added remote pod prune
Signed-off-by: Peter Hunt <pehunt@redhat.com>
Diffstat (limited to 'cmd/podman/pods_prune.go')
-rw-r--r--cmd/podman/pods_prune.go12
1 files changed, 2 insertions, 10 deletions
diff --git a/cmd/podman/pods_prune.go b/cmd/podman/pods_prune.go
index 4ffe6fc27..89401a98a 100644
--- a/cmd/podman/pods_prune.go
+++ b/cmd/podman/pods_prune.go
@@ -5,7 +5,6 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/shared"
- "github.com/containers/libpod/libpod"
"github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -43,15 +42,8 @@ func init() {
func prunePods(runtime *adapter.LocalRuntime, ctx context.Context, maxWorkers int, force bool) error {
var deleteFuncs []shared.ParallelWorkerInput
- filter := func(p *libpod.Pod) bool {
- state, err := shared.GetPodStatus(p)
- // pod states should be the same
- if state == shared.PodStateStopped || (state == shared.PodStateExited && err == nil) {
- return true
- }
- return false
- }
- delPods, err := runtime.Pods(filter)
+ states := []string{shared.PodStateStopped, shared.PodStateExited}
+ delPods, err := runtime.GetPodsByStatus(states)
if err != nil {
return err
}