diff options
author | umohnani8 <umohnani@redhat.com> | 2018-04-18 16:48:35 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-04-19 14:08:47 +0000 |
commit | 27107fdac1d75f97caab47cd13efb1d9900cf350 (patch) | |
tree | f5edafbb52505829b15e19ea6a9e66f4440e862b /libpod/image/pull.go | |
parent | 6a9dbf3305e93e5e1c3bff09402a9b801c935fbd (diff) | |
download | podman-27107fdac1d75f97caab47cd13efb1d9900cf350.tar.gz podman-27107fdac1d75f97caab47cd13efb1d9900cf350.tar.bz2 podman-27107fdac1d75f97caab47cd13efb1d9900cf350.zip |
Vendor in latest containers/image and contaners/storage
Made necessary changes to functions to include contex.Context wherever needed
Signed-off-by: umohnani8 <umohnani@redhat.com>
Closes: #640
Approved by: baude
Diffstat (limited to 'libpod/image/pull.go')
-rw-r--r-- | libpod/image/pull.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go index b2d32b255..74a773987 100644 --- a/libpod/image/pull.go +++ b/libpod/image/pull.go @@ -1,6 +1,7 @@ package image import ( + "context" "fmt" "io" "os" @@ -70,7 +71,7 @@ func (ir *Runtime) getPullStruct(srcRef types.ImageReference, destName string) ( } // returns a list of pullStruct with the srcRef and DstRef based on the transport being used -func (ir *Runtime) getPullListFromRef(srcRef types.ImageReference, imgName string, sc *types.SystemContext) ([]*pullStruct, error) { +func (ir *Runtime) getPullListFromRef(ctx context.Context, srcRef types.ImageReference, imgName string, sc *types.SystemContext) ([]*pullStruct, error) { var pullStructs []*pullStruct splitArr := strings.Split(imgName, ":") archFile := splitArr[len(splitArr)-1] @@ -89,7 +90,7 @@ func (ir *Runtime) getPullListFromRef(srcRef types.ImageReference, imgName strin // to pull the first image stored in the tar file if len(manifest) == 0 { // use the hex of the digest if no manifest is found - reference, err := getImageDigest(srcRef, sc) + reference, err := getImageDigest(ctx, srcRef, sc) if err != nil { return nil, err } @@ -104,7 +105,7 @@ func (ir *Runtime) getPullListFromRef(srcRef types.ImageReference, imgName strin dest = manifest[0].RepoTags[0] } else { // If the input image has no repotags, we need to feed it a dest anyways - dest, err = getImageDigest(srcRef, sc) + dest, err = getImageDigest(ctx, srcRef, sc) if err != nil { return nil, err } @@ -155,7 +156,7 @@ func (ir *Runtime) getPullListFromRef(srcRef types.ImageReference, imgName strin // pullImage pulls an image from configured registries // By default, only the latest tag (or a specific tag if requested) will be // pulled. -func (i *Image) pullImage(writer io.Writer, authfile, signaturePolicyPath string, signingOptions SigningOptions, dockerOptions *DockerRegistryOptions, forceSecure bool) (string, error) { +func (i *Image) pullImage(ctx context.Context, writer io.Writer, authfile, signaturePolicyPath string, signingOptions SigningOptions, dockerOptions *DockerRegistryOptions, forceSecure bool) (string, error) { // pullImage copies the image from the source to the destination var pullStructs []*pullStruct sc := GetSystemContext(signaturePolicyPath, authfile, false) @@ -167,7 +168,7 @@ func (i *Image) pullImage(writer io.Writer, authfile, signaturePolicyPath string return "", errors.Wrap(err, "error getting default registries to try") } } else { - pullStructs, err = i.imageruntime.getPullListFromRef(srcRef, i.InputName, sc) + pullStructs, err = i.imageruntime.getPullListFromRef(ctx, srcRef, i.InputName, sc) if err != nil { return "", errors.Wrapf(err, "error getting pullStruct info to pull image %q", i.InputName) } @@ -201,7 +202,7 @@ func (i *Image) pullImage(writer io.Writer, authfile, signaturePolicyPath string if writer != nil && (strings.HasPrefix(DockerTransport, imageInfo.srcRef.Transport().Name()) || imageInfo.srcRef.Transport().Name() == AtomicTransport) { io.WriteString(writer, fmt.Sprintf("Trying to pull %s...", imageInfo.image)) } - if err = cp.Image(policyContext, imageInfo.dstRef, imageInfo.srcRef, copyOptions); err != nil { + if err = cp.Image(ctx, policyContext, imageInfo.dstRef, imageInfo.srcRef, copyOptions); err != nil { if writer != nil { io.WriteString(writer, "Failed\n") } |