"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "vendor/github.com/docker/docker/client/image_pull.go" between
buildah-1.11.2.tar.gz and buildah-1.11.3.tar.gz

About: Buildah is a tool that facilitates building Open Container Initiative (OCI) container images.

image_pull.go  (buildah-1.11.2):image_pull.go  (buildah-1.11.3)
package client // import "github.com/docker/docker/client" package client // import "github.com/docker/docker/client"
import ( import (
"context" "context"
"io" "io"
"net/http"
"net/url" "net/url"
"strings" "strings"
"github.com/docker/distribution/reference" "github.com/docker/distribution/reference"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/errdefs"
) )
// ImagePull requests the docker host to pull an image from a remote registry. // ImagePull requests the docker host to pull an image from a remote registry.
// It executes the privileged function if the operation is unauthorized // It executes the privileged function if the operation is unauthorized
// and it tries one more time. // and it tries one more time.
// It's up to the caller to handle the io.ReadCloser and close it properly. // It's up to the caller to handle the io.ReadCloser and close it properly.
// //
// FIXME(vdemeester): there is currently used in a few way in docker/docker // FIXME(vdemeester): there is currently used in a few way in docker/docker
// - if not in trusted content, ref is used to pass the whole reference, and tag is empty // - if not in trusted content, ref is used to pass the whole reference, and tag is empty
// - if in trusted content, ref is used to pass the reference name, and tag for the digest // - if in trusted content, ref is used to pass the reference name, and tag for the digest
skipping to change at line 38 skipping to change at line 38
query := url.Values{} query := url.Values{}
query.Set("fromImage", reference.FamiliarName(ref)) query.Set("fromImage", reference.FamiliarName(ref))
if !options.All { if !options.All {
query.Set("tag", getAPITagFromNamedRef(ref)) query.Set("tag", getAPITagFromNamedRef(ref))
} }
if options.Platform != "" { if options.Platform != "" {
query.Set("platform", strings.ToLower(options.Platform)) query.Set("platform", strings.ToLower(options.Platform))
} }
resp, err := cli.tryImageCreate(ctx, query, options.RegistryAuth) resp, err := cli.tryImageCreate(ctx, query, options.RegistryAuth)
if resp.statusCode == http.StatusUnauthorized && options.PrivilegeFunc != nil { if errdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil {
newAuthHeader, privilegeErr := options.PrivilegeFunc() newAuthHeader, privilegeErr := options.PrivilegeFunc()
if privilegeErr != nil { if privilegeErr != nil {
return nil, privilegeErr return nil, privilegeErr
} }
resp, err = cli.tryImageCreate(ctx, query, newAuthHeader) resp, err = cli.tryImageCreate(ctx, query, newAuthHeader)
} }
if err != nil { if err != nil {
return nil, err return nil, err
} }
return resp.body, nil return resp.body, nil
 End of changes. 3 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)