mirror of
https://github.com/containers/podman.git
synced 2025-06-29 15:08:09 +08:00
Simplify pullGoalFromPossiblyUnqualifiedName
After inlining assembleWithTransport, we have two branches with the same prepending of decomposedImage.transport; move that out of the branches. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
@ -286,11 +286,11 @@ func (ir *Runtime) pullGoalFromPossiblyUnqualifiedName(inputName string) (*pullG
|
|||||||
if decomposedImage.hasRegistry {
|
if decomposedImage.hasRegistry {
|
||||||
var imageName, destName string
|
var imageName, destName string
|
||||||
if hasShaInInputName(inputName) {
|
if hasShaInInputName(inputName) {
|
||||||
imageName = fmt.Sprintf("%s%s", decomposedImage.transport, inputName)
|
imageName = inputName
|
||||||
} else {
|
} else {
|
||||||
imageName = fmt.Sprintf("%s%s", decomposedImage.transport, decomposedImage.assemble())
|
imageName = decomposedImage.assemble()
|
||||||
}
|
}
|
||||||
srcRef, err := alltransports.ParseImageName(imageName)
|
srcRef, err := alltransports.ParseImageName(fmt.Sprintf("%s%s", decomposedImage.transport, imageName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "unable to parse '%s'", inputName)
|
return nil, errors.Wrapf(err, "unable to parse '%s'", inputName)
|
||||||
}
|
}
|
||||||
@ -318,11 +318,11 @@ func (ir *Runtime) pullGoalFromPossiblyUnqualifiedName(inputName string) (*pullG
|
|||||||
var refPairs []pullRefPair
|
var refPairs []pullRefPair
|
||||||
for _, registry := range searchRegistries {
|
for _, registry := range searchRegistries {
|
||||||
decomposedImage.registry = registry
|
decomposedImage.registry = registry
|
||||||
imageName := fmt.Sprintf("%s%s", decomposedImage.transport, decomposedImage.assemble())
|
imageName := decomposedImage.assemble()
|
||||||
if hasShaInInputName(inputName) {
|
if hasShaInInputName(inputName) {
|
||||||
imageName = fmt.Sprintf("%s%s/%s", decomposedImage.transport, registry, inputName)
|
imageName = fmt.Sprintf("%s/%s", registry, inputName)
|
||||||
}
|
}
|
||||||
srcRef, err := alltransports.ParseImageName(imageName)
|
srcRef, err := alltransports.ParseImageName(fmt.Sprintf("%s%s", decomposedImage.transport, imageName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "unable to parse '%s'", inputName)
|
return nil, errors.Wrapf(err, "unable to parse '%s'", inputName)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user