diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-06-23 13:05:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 13:05:31 -0400 |
commit | 7ed18eaec6a3ad6aff45cec79fdb15e7ffb6396c (patch) | |
tree | b8d6e6c38c0efa5b48743b2b4e8bd96c3f7398c4 /pkg/api/handlers | |
parent | 3322ea2c68e1bac86748534615fd35c19bc0a655 (diff) | |
parent | 5fc622f945de46db85c8cc0284f935bac1929e3a (diff) | |
download | podman-7ed18eaec6a3ad6aff45cec79fdb15e7ffb6396c.tar.gz podman-7ed18eaec6a3ad6aff45cec79fdb15e7ffb6396c.tar.bz2 podman-7ed18eaec6a3ad6aff45cec79fdb15e7ffb6396c.zip |
Merge pull request #10739 from vrothberg/fix-10682
create: support images with invalid platform
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r-- | pkg/api/handlers/libpod/images_pull.go | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/pkg/api/handlers/libpod/images_pull.go b/pkg/api/handlers/libpod/images_pull.go index e88b53a4b..04b415638 100644 --- a/pkg/api/handlers/libpod/images_pull.go +++ b/pkg/api/handlers/libpod/images_pull.go @@ -26,14 +26,16 @@ func ImagesPull(w http.ResponseWriter, r *http.Request) { runtime := r.Context().Value("runtime").(*libpod.Runtime) decoder := r.Context().Value("decoder").(*schema.Decoder) query := struct { - Reference string `schema:"reference"` - OS string `schema:"OS"` - Arch string `schema:"Arch"` - Variant string `schema:"Variant"` - TLSVerify bool `schema:"tlsVerify"` - AllTags bool `schema:"allTags"` + Reference string `schema:"reference"` + OS string `schema:"OS"` + Arch string `schema:"Arch"` + Variant string `schema:"Variant"` + TLSVerify bool `schema:"tlsVerify"` + AllTags bool `schema:"allTags"` + PullPolicy string `schema:"policy"` }{ - TLSVerify: true, + TLSVerify: true, + PullPolicy: "always", } if err := decoder.Decode(&query, r.URL.Query()); err != nil { @@ -83,12 +85,18 @@ func ImagesPull(w http.ResponseWriter, r *http.Request) { pullOptions.Writer = writer + pullPolicy, err := config.ParsePullPolicy(query.PullPolicy) + if err != nil { + utils.Error(w, "failed to parse pull policy", http.StatusBadRequest, err) + return + } + var pulledImages []*libimage.Image var pullError error runCtx, cancel := context.WithCancel(r.Context()) go func() { defer cancel() - pulledImages, pullError = runtime.LibimageRuntime().Pull(runCtx, query.Reference, config.PullPolicyAlways, pullOptions) + pulledImages, pullError = runtime.LibimageRuntime().Pull(runCtx, query.Reference, pullPolicy, pullOptions) }() flush := func() { |