mirror of https://github.com/containers/podman.git
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>
This commit is contained in:
parent
81204487db
commit
633501b1b7
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue