diff options
author | Miloslav Trmač <mitr@redhat.com> | 2018-07-27 01:16:00 +0200 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-01 18:22:58 +0000 |
commit | d61bed2b2dcca27d8baecc2b63255f9df456ba2f (patch) | |
tree | 5ddf07ff7e3850dc9704003305191108295867c4 /libpod/image/pull.go | |
parent | 9c9401a96c0b7d43dcea19c2972ef9612cc0a136 (diff) | |
download | podman-d61bed2b2dcca27d8baecc2b63255f9df456ba2f.tar.gz podman-d61bed2b2dcca27d8baecc2b63255f9df456ba2f.tar.bz2 podman-d61bed2b2dcca27d8baecc2b63255f9df456ba2f.zip |
Split refNamesFromImageReference from Runtime.getPullListFromRef
Again, that makes the core logic independent from Runtime == containers-storage,
and easier to test independently.
So, this also adds tests.
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 | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go index f7131f11e..bbabba7b9 100644 --- a/libpod/image/pull.go +++ b/libpod/image/pull.go @@ -84,8 +84,8 @@ func getPullRefName(srcRef types.ImageReference, destName string) (*pullRefName, }, nil } -// returns a list of pullRefPair with the srcRef and DstRef based on the transport being used -func (ir *Runtime) getPullListFromRef(ctx context.Context, srcRef types.ImageReference, imgName string, sc *types.SystemContext) ([]*pullRefPair, error) { +// refNamesFromImageReference returns a list of pullRefName for a single ImageReference, depending on the used transport. +func refNamesFromImageReference(ctx context.Context, srcRef types.ImageReference, imgName string, sc *types.SystemContext) ([]*pullRefName, error) { var pullNames []*pullRefName splitArr := strings.Split(imgName, ":") archFile := splitArr[len(splitArr)-1] @@ -178,8 +178,17 @@ func (ir *Runtime) getPullListFromRef(ctx context.Context, srcRef types.ImageRef } pullNames = append(pullNames, pullInfo) } + return pullNames, nil +} + +// getPullListFromRef returns a list of pullRefPair for a single ImageReference, depending on the used transport. +func (ir *Runtime) getPullListFromRef(ctx context.Context, srcRef types.ImageReference, imgName string, sc *types.SystemContext) ([]*pullRefPair, error) { + refNames, err := refNamesFromImageReference(ctx, srcRef, imgName, sc) + if err != nil { + return nil, err + } - return ir.pullRefPairsFromRefNames(pullNames) + return ir.pullRefPairsFromRefNames(refNames) } // pullImage pulls an image from configured registries |