diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2021-01-09 23:38:26 +0100 |
---|---|---|
committer | Paul Holzinger <paul.holzinger@web.de> | 2021-01-09 23:38:26 +0100 |
commit | 82bce7d906c5b5aa1d98782bed8d5e77637fc0ef (patch) | |
tree | e5eec82d1489e353c625907e9f6745c4c6dc6274 /pkg/api/handlers/libpod | |
parent | 38baf3d5e2bc5c1e8b216dc072ea1d3eaf5053b8 (diff) | |
download | podman-82bce7d906c5b5aa1d98782bed8d5e77637fc0ef.tar.gz podman-82bce7d906c5b5aa1d98782bed8d5e77637fc0ef.tar.bz2 podman-82bce7d906c5b5aa1d98782bed8d5e77637fc0ef.zip |
Use abi PodPs implementation for libpod/pods/json endpoint
This removes unnecessary code duplication.
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'pkg/api/handlers/libpod')
-rw-r--r-- | pkg/api/handlers/libpod/pods.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/api/handlers/libpod/pods.go b/pkg/api/handlers/libpod/pods.go index de373f05f..2409d3a20 100644 --- a/pkg/api/handlers/libpod/pods.go +++ b/pkg/api/handlers/libpod/pods.go @@ -43,6 +43,7 @@ func PodCreate(w http.ResponseWriter, r *http.Request) { } func Pods(w http.ResponseWriter, r *http.Request) { + runtime := r.Context().Value("runtime").(*libpod.Runtime) decoder := r.Context().Value("decoder").(*schema.Decoder) query := struct { Filters map[string][]string `schema:"filters"` @@ -55,7 +56,11 @@ func Pods(w http.ResponseWriter, r *http.Request) { return } - pods, err := utils.GetPods(w, r) + containerEngine := abi.ContainerEngine{Libpod: runtime} + podPSOptions := entities.PodPSOptions{ + Filters: query.Filters, + } + pods, err := containerEngine.PodPs(r.Context(), podPSOptions) if err != nil { utils.Error(w, "Something went wrong", http.StatusInternalServerError, err) return |