diff options
author | Miloslav Trmač <mitr@redhat.com> | 2018-07-28 06:54:34 +0200 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-01 18:22:59 +0000 |
commit | 2d5410d3496096ed2022a872b413a58ceee9fb98 (patch) | |
tree | 02d4bce1de4dbc07ded2788acb7ee0c9b4416275 /libpod/image/pull.go | |
parent | dbe2395769933a53058e81386f8f7a072acd15a2 (diff) | |
download | podman-2d5410d3496096ed2022a872b413a58ceee9fb98.tar.gz podman-2d5410d3496096ed2022a872b413a58ceee9fb98.tar.bz2 podman-2d5410d3496096ed2022a872b413a58ceee9fb98.zip |
Move pullImage from Image to Runtime
pullImage (now) only uses Image.InputName; it is really used to _create_
an Image object, based on the pull results (as is most visible in the
LoadFromArchive caller), so it should not be a method on it.
This also simplifies a bit the number of different kids of uses of
Image.InputName; still apparently not enough to clearly document
the field, though.
Should not change behavior.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Closes: #1176
Approved by: rhatdan
Diffstat (limited to 'libpod/image/pull.go')
-rw-r--r-- | libpod/image/pull.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go index 1e3ac44b1..11041ad36 100644 --- a/libpod/image/pull.go +++ b/libpod/image/pull.go @@ -200,24 +200,24 @@ func (ir *Runtime) pullGoalFromImageReference(ctx context.Context, srcRef types. return ir.pullGoalFromGoalNames(goalNames) } -// pullImage pulls an image from configured registries +// 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. -func (i *Image) pullImage(ctx context.Context, writer io.Writer, authfile, signaturePolicyPath string, signingOptions SigningOptions, dockerOptions *DockerRegistryOptions, forceSecure bool) ([]string, error) { +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(i.InputName) + srcRef, err := alltransports.ParseImageName(inputName) if err != nil { // could be trying to pull from registry with short name - goal, err = i.pullGoalFromPossiblyUnqualifiedName() + goal, err = ir.pullGoalFromPossiblyUnqualifiedName(inputName) if err != nil { return nil, errors.Wrap(err, "error getting default registries to try") } } else { - goal, err = i.imageruntime.pullGoalFromImageReference(ctx, srcRef, i.InputName, sc) + goal, err = ir.pullGoalFromImageReference(ctx, srcRef, inputName, sc) if err != nil { - return nil, errors.Wrapf(err, "error determining pull goal for image %q", i.InputName) + return nil, errors.Wrapf(err, "error determining pull goal for image %q", inputName) } } policyContext, err := getPolicyContext(sc) @@ -338,14 +338,14 @@ func pullGoalNamesFromPossiblyUnqualifiedName(inputName string) (*pullGoalNames, }, nil } -// pullGoalFromPossiblyUnqualifiedName looks at a decomposed image and determines the possible +// pullGoalFromPossiblyUnqualifiedName looks at inputName and determines the possible // image references to try pulling in combination with the registries.conf file as well -func (i *Image) pullGoalFromPossiblyUnqualifiedName() (pullGoal, error) { - goalNames, err := pullGoalNamesFromPossiblyUnqualifiedName(i.InputName) +func (ir *Runtime) pullGoalFromPossiblyUnqualifiedName(inputName string) (pullGoal, error) { + goalNames, err := pullGoalNamesFromPossiblyUnqualifiedName(inputName) if err != nil { return pullGoal{}, err } - return i.imageruntime.pullGoalFromGoalNames(goalNames) + return ir.pullGoalFromGoalNames(goalNames) } // pullGoalFromGoalNames converts a pullGoalNames to a pullGoal |