summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/libpod/containers.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/api/handlers/libpod/containers.go')
-rw-r--r--pkg/api/handlers/libpod/containers.go26
1 files changed, 21 insertions, 5 deletions
diff --git a/pkg/api/handlers/libpod/containers.go b/pkg/api/handlers/libpod/containers.go
index 5cbfb11eb..3902bdc9b 100644
--- a/pkg/api/handlers/libpod/containers.go
+++ b/pkg/api/handlers/libpod/containers.go
@@ -32,10 +32,6 @@ func ContainerExists(w http.ResponseWriter, r *http.Request) {
}
func ListContainers(w http.ResponseWriter, r *http.Request) {
- var (
- //filterFuncs []libpod.ContainerFilter
- //pss []entities.ListContainer
- )
decoder := r.Context().Value("decoder").(*schema.Decoder)
query := struct {
All bool `schema:"all"`
@@ -54,10 +50,10 @@ func ListContainers(w http.ResponseWriter, r *http.Request) {
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
return
}
-
runtime := r.Context().Value("runtime").(*libpod.Runtime)
opts := entities.ContainerListOptions{
All: query.All,
+ Filters: query.Filters,
Last: query.Last,
Size: query.Size,
Sort: "",
@@ -285,3 +281,23 @@ func Restore(w http.ResponseWriter, r *http.Request) {
}
utils.WriteResponse(w, http.StatusOK, entities.RestoreReport{Id: ctr.ID()})
}
+
+func InitContainer(w http.ResponseWriter, r *http.Request) {
+ name := utils.GetName(r)
+ runtime := r.Context().Value("runtime").(*libpod.Runtime)
+ ctr, err := runtime.LookupContainer(name)
+ if err != nil {
+ utils.ContainerNotFound(w, name, err)
+ return
+ }
+ err = ctr.Init(r.Context())
+ if errors.Cause(err) == define.ErrCtrStateInvalid {
+ utils.Error(w, "container already initialized", http.StatusNotModified, err)
+ return
+ }
+ if err != nil {
+ utils.InternalServerError(w, err)
+ return
+ }
+ utils.WriteResponse(w, http.StatusNoContent, "")
+}