Filter pods through pod list api

Refactored current filter pods flow through the shared pod functions
so filter pod functionalities can be shared between api and cmd.

Signed-off-by: Sujil02 <sushah@redhat.com>
This commit is contained in:
Sujil02
2020-03-09 20:07:55 -04:00
parent f3a28de324
commit 15326f051d
8 changed files with 268 additions and 146 deletions

View File

@ -103,7 +103,6 @@ func PodCreate(w http.ResponseWriter, r *http.Request) {
func Pods(w http.ResponseWriter, r *http.Request) {
var (
runtime = r.Context().Value("runtime").(*libpod.Runtime)
podInspectData []*libpod.PodInspect
)
decoder := r.Context().Value("decoder").(*schema.Decoder)
@ -118,12 +117,8 @@ func Pods(w http.ResponseWriter, r *http.Request) {
return
}
if len(query.Filters) > 0 {
utils.Error(w, "filters are not implemented yet", http.StatusInternalServerError, define.ErrNotImplemented)
return
}
pods, err := utils.GetPods(w, r)
pods, err := runtime.GetAllPods()
if err != nil {
utils.Error(w, "Something went wrong", http.StatusInternalServerError, err)
return