diff options
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/pods_prune.go | 12 | ||||
-rw-r--r-- | cmd/podman/varlink/io.podman.varlink | 3 |
2 files changed, 5 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 } diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink index b5295273a..497f130bc 100644 --- a/cmd/podman/varlink/io.podman.varlink +++ b/cmd/podman/varlink/io.podman.varlink @@ -1053,6 +1053,9 @@ method TopPod(pod: string, latest: bool, descriptors: []string) -> (stats: []str # ~~~ method GetPodStats(name: string) -> (pod: string, containers: []ContainerStats) +# GetPodsByStatus searches for pods whose status is included in statuses +method GetPodsByStatus(statuses: []string) -> (pods: []string) + # ImageExists talks a full or partial image ID or name and returns an int as to whether # the image exists in local storage. An int result of 0 means the image does exist in # local storage; whereas 1 indicates the image does not exists in local storage. |