diff options
author | Miloslav Trmač <mitr@redhat.com> | 2018-07-19 00:07:15 +0200 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-07-23 12:44:38 +0000 |
commit | 347ba2cc253e37e2b4f506133610e3397bca1a99 (patch) | |
tree | 0330696e4ddde20b1e7fad546956a2332ce0d06d /libpod/image | |
parent | b500f9275e9152d2fee9287edbe3db80e4bf9ac6 (diff) | |
download | podman-347ba2cc253e37e2b4f506133610e3397bca1a99.tar.gz podman-347ba2cc253e37e2b4f506133610e3397bca1a99.tar.bz2 podman-347ba2cc253e37e2b4f506133610e3397bca1a99.zip |
Split createNamesToPull into ref{Names,Pairs}FromPossiblyUnqualifiedName
One part creates []*pullRefName; the other just trivially converts it
into []*pullRefPair.
Also use much more explicit names to explain the functionality.
Should not change behavior.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Closes: #1112
Approved by: rhatdan
Diffstat (limited to 'libpod/image')
-rw-r--r-- | libpod/image/pull.go | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go index f3b3ad5d9..bd0a8a382 100644 --- a/libpod/image/pull.go +++ b/libpod/image/pull.go @@ -195,7 +195,7 @@ func (i *Image) pullImage(ctx context.Context, writer io.Writer, authfile, signa srcRef, err := alltransports.ParseImageName(i.InputName) if err != nil { // could be trying to pull from registry with short name - pullRefPairs, err = i.createNamesToPull() + pullRefPairs, err = i.refPairsFromPossiblyUnqualifiedName() if err != nil { return nil, errors.Wrap(err, "error getting default registries to try") } @@ -264,9 +264,9 @@ func (i *Image) pullImage(ctx context.Context, writer io.Writer, authfile, signa return images, nil } -// createNamesToPull looks at a decomposed image and determines the possible -// images names to try pulling in combination with the registries.conf file as well -func (i *Image) createNamesToPull() ([]*pullRefPair, error) { +// refNamesFromPossiblyUnqualifiedName looks at a decomposed image and determines the possible +// image names to try pulling in combination with the registries.conf file as well +func (i *Image) refNamesFromPossiblyUnqualifiedName() ([]*pullRefName, error) { var ( pullNames []*pullRefName imageName string @@ -320,7 +320,17 @@ func (i *Image) createNamesToPull() ([]*pullRefPair, error) { pullNames = append(pullNames, &ps) } } - return i.imageruntime.pullRefPairsFromRefNames(pullNames) + return pullNames, nil +} + +// refPairsFromPossiblyUnqualifiedName looks at a decomposed image and determines the possible +// image references to try pulling in combination with the registries.conf file as well +func (i *Image) refPairsFromPossiblyUnqualifiedName() ([]*pullRefPair, error) { + refNames, err := i.refNamesFromPossiblyUnqualifiedName() + if err != nil { + return nil, err + } + return i.imageruntime.pullRefPairsFromRefNames(refNames) } // pullRefPairsFromNames converts a []*pullRefName to []*pullRefPair |