summaryrefslogtreecommitdiff
path: root/libpod/image
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2019-01-09 21:01:56 +0100
committerMiloslav Trmač <mitr@redhat.com>2019-01-14 04:07:23 +0100
commit633501b1b7450676c47d891092b53680206b8398 (patch)
tree79719753914127aa703f0858eb6b1cf390ed1a3c /libpod/image
parent81204487dbf9903f4a8784be9a580f8a46d1d381 (diff)
downloadpodman-633501b1b7450676c47d891092b53680206b8398.tar.gz
podman-633501b1b7450676c47d891092b53680206b8398.tar.bz2
podman-633501b1b7450676c47d891092b53680206b8398.zip
Use getPullRefPair / getSinglePullRefPairGoal in pullGoalFromPossiblyUnqualifiedName
This shortens the code a bit, but most importantly ensures that all pulls from docker.Transport are processed exactly the same way, and there is only a single store.ParseStoreReference in the pull code. It's a bit wasteful to call decompose() in getPullRefPair just after pullGoalFromPossiblyUnqualifiedName has qualified the name, but on balance only having exactly one code path seems worth it. Alternatively we could split getPullRefPairToQualifiedDestination from getPullRefPair. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Diffstat (limited to 'libpod/image')
-rw-r--r--libpod/image/pull.go19
1 files changed, 3 insertions, 16 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go
index af6b84c34..434b83520 100644
--- a/libpod/image/pull.go
+++ b/libpod/image/pull.go
@@ -283,16 +283,7 @@ func (ir *Runtime) pullGoalFromPossiblyUnqualifiedName(inputName string) (*pullG
if err != nil {
return nil, errors.Wrapf(err, "unable to parse '%s'", inputName)
}
- destRef, err := is.Transport.ParseStoreReference(ir.store, inputName)
- if err != nil {
- return nil, errors.Wrapf(err, "error parsing dest reference name %#v", inputName)
- }
- ps := pullRefPair{
- image: inputName,
- srcRef: srcRef,
- dstRef: destRef,
- }
- return singlePullRefPairGoal(ps), nil
+ return ir.getSinglePullRefPairGoal(srcRef, inputName)
}
searchRegistries, err := registries.GetRegistries()
@@ -310,13 +301,9 @@ func (ir *Runtime) pullGoalFromPossiblyUnqualifiedName(inputName string) (*pullG
if err != nil {
return nil, errors.Wrapf(err, "unable to parse '%s'", imageName)
}
- ps := pullRefPair{
- image: imageName,
- srcRef: srcRef,
- }
- ps.dstRef, err = is.Transport.ParseStoreReference(ir.store, ps.image)
+ ps, err := ir.getPullRefPair(srcRef, imageName)
if err != nil {
- return nil, errors.Wrapf(err, "error parsing dest reference name %#v", ps.image)
+ return nil, err
}
refPairs = append(refPairs, ps)
}