mirror of
https://github.com/containers/podman.git
synced 2025-06-19 00:06:43 +08:00
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:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user