diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-14 14:34:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-14 14:34:18 +0200 |
commit | 004826653f2a8b064af8c1f055b1a402f4060d1c (patch) | |
tree | 715f035f049b161b55932fa9586f24c1876f11a5 /pkg/api/handlers/libpod | |
parent | 5cf64aee11063bc8e7ff22f1365b0bf6b3ab0900 (diff) | |
parent | d8d1aa49d27d51f914a0858ab99c57d7dc929926 (diff) | |
download | podman-004826653f2a8b064af8c1f055b1a402f4060d1c.tar.gz podman-004826653f2a8b064af8c1f055b1a402f4060d1c.tar.bz2 podman-004826653f2a8b064af8c1f055b1a402f4060d1c.zip |
Merge pull request #5803 from baude/v2init
v2podman add container init
Diffstat (limited to 'pkg/api/handlers/libpod')
-rw-r--r-- | pkg/api/handlers/libpod/containers.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pkg/api/handlers/libpod/containers.go b/pkg/api/handlers/libpod/containers.go index 5cbfb11eb..086bef847 100644 --- a/pkg/api/handlers/libpod/containers.go +++ b/pkg/api/handlers/libpod/containers.go @@ -285,3 +285,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, "") +} |