summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2018-07-28 07:41:05 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-01 18:22:59 +0000
commit558a1bd7760c1505a8788a467d9315f94f2ad097 (patch)
treea8cea29df4d6da5028da301dab37ed6b0e2133d7 /libpod
parent7f5efd8d0436e3f094ddeef02d3489c395c9e0eb (diff)
downloadpodman-558a1bd7760c1505a8788a467d9315f94f2ad097.tar.gz
podman-558a1bd7760c1505a8788a467d9315f94f2ad097.tar.bz2
podman-558a1bd7760c1505a8788a467d9315f94f2ad097.zip
Split doPullImage from pullImage
Now that we have a pullGoal, separate determination of the goal from performing it; we will then introduce another entry point with a supplied types.ImageReference. Also remove or correct some misleading comments. Should not change behavior (but does not add unit tests). Signed-off-by: Miloslav Trmač <mitr@redhat.com> Closes: #1176 Approved by: rhatdan
Diffstat (limited to 'libpod')
-rw-r--r--libpod/image/pull.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go
index 787c065cc..4240d72d8 100644
--- a/libpod/image/pull.go
+++ b/libpod/image/pull.go
@@ -200,11 +200,8 @@ func (ir *Runtime) pullGoalFromImageReference(ctx context.Context, srcRef types.
return ir.pullGoalFromGoalNames(goalNames)
}
-// pullImage pulls an image from configured registries based on inputName.
-// By default, only the latest tag (or a specific tag if requested) will be
-// pulled.
+// pullImage pulls an image based on input name, which may involve from configured registries.
func (ir *Runtime) pullImage(ctx context.Context, inputName string, 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 goal pullGoal
sc := GetSystemContext(signaturePolicyPath, authfile, false)
srcRef, err := alltransports.ParseImageName(inputName)
@@ -220,6 +217,11 @@ func (ir *Runtime) pullImage(ctx context.Context, inputName string, writer io.Wr
return nil, errors.Wrapf(err, "error determining pull goal for image %q", inputName)
}
}
+ return ir.doPullImage(ctx, sc, goal, writer, signingOptions, dockerOptions, forceSecure)
+}
+
+// doPullImage is an internal helper interpreting pullGoal. Almost everyone should call one of the callers of doPullImage instead.
+func (ir *Runtime) doPullImage(ctx context.Context, sc *types.SystemContext, goal pullGoal, writer io.Writer, signingOptions SigningOptions, dockerOptions *DockerRegistryOptions, forceSecure bool) ([]string, error) {
policyContext, err := getPolicyContext(sc)
if err != nil {
return nil, err