diff options
author | Miloslav Trmač <mitr@redhat.com> | 2019-01-09 18:54:17 +0100 |
---|---|---|
committer | Miloslav Trmač <mitr@redhat.com> | 2019-01-14 04:07:23 +0100 |
commit | 99d2259f8a71dbe5a0d9e78757b51551ce0eb8b1 (patch) | |
tree | 029d1c0f0d53ec6d190075d651b5de2a78df9461 /libpod/image | |
parent | 3d98c42a3f7822bf608834505adcffec7f75bf28 (diff) | |
download | podman-99d2259f8a71dbe5a0d9e78757b51551ce0eb8b1.tar.gz podman-99d2259f8a71dbe5a0d9e78757b51551ce0eb8b1.tar.bz2 podman-99d2259f8a71dbe5a0d9e78757b51551ce0eb8b1.zip |
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>
Diffstat (limited to 'libpod/image')
-rw-r--r-- | libpod/image/pull.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go index 82fe0fdd6..d09ddd599 100644 --- a/libpod/image/pull.go +++ b/libpod/image/pull.go @@ -286,11 +286,11 @@ func (ir *Runtime) pullGoalFromPossiblyUnqualifiedName(inputName string) (*pullG if decomposedImage.hasRegistry { var imageName, destName string if hasShaInInputName(inputName) { - imageName = fmt.Sprintf("%s%s", decomposedImage.transport, inputName) + imageName = inputName } 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 { return nil, errors.Wrapf(err, "unable to parse '%s'", inputName) } @@ -318,11 +318,11 @@ func (ir *Runtime) pullGoalFromPossiblyUnqualifiedName(inputName string) (*pullG var refPairs []pullRefPair for _, registry := range searchRegistries { decomposedImage.registry = registry - imageName := fmt.Sprintf("%s%s", decomposedImage.transport, decomposedImage.assemble()) + imageName := decomposedImage.assemble() 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 { return nil, errors.Wrapf(err, "unable to parse '%s'", inputName) } |