summaryrefslogtreecommitdiff
path: root/pkg/adapter/runtime.go
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2019-04-18 10:34:27 -0700
committerJhon Honce <jhonce@redhat.com>2019-04-18 15:13:56 -0700
commit69962682e990ddb9437291b98bd335e74c090fc8 (patch)
tree409dfe0466aa8024a6295e40901a17b8b62b8691 /pkg/adapter/runtime.go
parente4947e5fd699f584cb815a4f4fd92f22b62f2c8a (diff)
downloadpodman-69962682e990ddb9437291b98bd335e74c090fc8.tar.gz
podman-69962682e990ddb9437291b98bd335e74c090fc8.tar.bz2
podman-69962682e990ddb9437291b98bd335e74c090fc8.zip
Refactor of 'podman prune' to better support remote
* Push iterations into the service not the client * Add e2e tests * Refactor to use new frameworks Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg/adapter/runtime.go')
-rw-r--r--pkg/adapter/runtime.go28
1 files changed, 9 insertions, 19 deletions
diff --git a/pkg/adapter/runtime.go b/pkg/adapter/runtime.go
index 6ed9cee77..753f7c944 100644
--- a/pkg/adapter/runtime.go
+++ b/pkg/adapter/runtime.go
@@ -7,7 +7,6 @@ import (
"context"
"io"
"io/ioutil"
- "k8s.io/api/core/v1"
"os"
"text/template"
@@ -25,6 +24,7 @@ import (
"github.com/containers/libpod/pkg/rootless"
"github.com/containers/storage/pkg/archive"
"github.com/pkg/errors"
+ "k8s.io/api/core/v1"
)
// LocalRuntime describes a typical libpod runtime
@@ -43,6 +43,11 @@ type Container struct {
*libpod.Container
}
+// Pod encapsulates the libpod.Pod structure, helps with remote vs. local
+type Pod struct {
+ *libpod.Pod
+}
+
// Volume ...
type Volume struct {
*libpod.Volume
@@ -371,8 +376,7 @@ func (r *LocalRuntime) GenerateKube(c *cliconfig.GenerateKubeValues) (*v1.Pod, *
}
// GetPodsByStatus returns a slice of pods filtered by a libpod status
-func (r *LocalRuntime) GetPodsByStatus(statuses []string) ([]*Pod, error) {
- var adapterPods []*Pod
+func (r *LocalRuntime) GetPodsByStatus(statuses []string) ([]*libpod.Pod, error) {
filterFunc := func(p *libpod.Pod) bool {
state, _ := shared.GetPodStatus(p)
@@ -383,25 +387,11 @@ func (r *LocalRuntime) GetPodsByStatus(statuses []string) ([]*Pod, error) {
}
return false
}
+
pods, err := r.Runtime.Pods(filterFunc)
if err != nil {
return nil, err
}
- for _, p := range pods {
- adapterPod := Pod{
- p,
- }
- adapterPods = append(adapterPods, &adapterPod)
- }
- return adapterPods, nil
-}
-// RemovePod removes a pod
-// If removeCtrs is specified, containers will be removed
-// Otherwise, a pod that is not empty will return an error and not be removed
-// If force is specified with removeCtrs, all containers will be stopped before
-// being removed
-// Otherwise, the pod will not be removed if any containers are running
-func (r *LocalRuntime) RemovePod(ctx context.Context, p *Pod, removeCtrs, force bool) error {
- return r.Runtime.RemovePod(ctx, p.Pod, removeCtrs, force)
+ return pods, nil
}