summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/libpod/containers_create.go
diff options
context:
space:
mode:
authorVladimir Kochnev <hashtable@yandex.ru>2022-08-17 03:07:01 +0300
committerVladimir Kochnev <hashtable@yandex.ru>2022-08-18 23:48:43 +0300
commite48681e600e55718a9699006ac940738fa08f896 (patch)
tree7db176724b5e0e92ff1e85a3f2ff07d7cf8cdd34 /pkg/api/handlers/libpod/containers_create.go
parentb9fb60c68acb57e56edae0b35dd408f454d32be5 (diff)
downloadpodman-e48681e600e55718a9699006ac940738fa08f896.tar.gz
podman-e48681e600e55718a9699006ac940738fa08f896.tar.bz2
podman-e48681e600e55718a9699006ac940738fa08f896.zip
Use request Context() in API handlers
Request object has its own context which must be used during a request lifetime instead of just context.Background() [NO NEW TESTS NEEDED] Signed-off-by: Vladimir Kochnev <hashtable@yandex.ru>
Diffstat (limited to 'pkg/api/handlers/libpod/containers_create.go')
-rw-r--r--pkg/api/handlers/libpod/containers_create.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/pkg/api/handlers/libpod/containers_create.go b/pkg/api/handlers/libpod/containers_create.go
index 1307c267a..429f45f91 100644
--- a/pkg/api/handlers/libpod/containers_create.go
+++ b/pkg/api/handlers/libpod/containers_create.go
@@ -1,7 +1,6 @@
package libpod
import (
- "context"
"encoding/json"
"fmt"
"net/http"
@@ -63,12 +62,12 @@ func CreateContainer(w http.ResponseWriter, r *http.Request) {
utils.InternalServerError(w, err)
return
}
- rtSpec, spec, opts, err := generate.MakeContainer(context.Background(), runtime, &sg, false, nil)
+ rtSpec, spec, opts, err := generate.MakeContainer(r.Context(), runtime, &sg, false, nil)
if err != nil {
utils.InternalServerError(w, err)
return
}
- ctr, err := generate.ExecuteCreate(context.Background(), runtime, rtSpec, spec, false, opts...)
+ ctr, err := generate.ExecuteCreate(r.Context(), runtime, rtSpec, spec, false, opts...)
if err != nil {
utils.InternalServerError(w, err)
return