diff options
Diffstat (limited to 'libpod/image')
-rw-r--r-- | libpod/image/image.go | 6 | ||||
-rw-r--r-- | libpod/image/pull.go | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/libpod/image/image.go b/libpod/image/image.go index 7ea851f5d..0e236503d 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -1074,9 +1074,3 @@ func (i *Image) Comment(ctx context.Context, manifestType string) (string, error } return ociv1Img.History[0].Comment, nil } - -// HasShaInInputName returns a bool as to whether the user provide an image name that includes -// a reference to a specific sha -func (i *Image) HasShaInInputName() bool { - return strings.Contains(i.InputName, "@sha256:") -} diff --git a/libpod/image/pull.go b/libpod/image/pull.go index bd0a8a382..529378019 100644 --- a/libpod/image/pull.go +++ b/libpod/image/pull.go @@ -264,6 +264,12 @@ func (i *Image) pullImage(ctx context.Context, writer io.Writer, authfile, signa return images, nil } +// hasShaInInputName returns a bool as to whether the user provided an image name that includes +// a reference to a specific sha +func hasShaInInputName(inputName string) bool { + return strings.Contains(inputName, "@sha256:") +} + // refNamesFromPossiblyUnqualifiedName looks at a decomposed image and determines the possible // image names to try pulling in combination with the registries.conf file as well func (i *Image) refNamesFromPossiblyUnqualifiedName() ([]*pullRefName, error) { @@ -277,7 +283,7 @@ func (i *Image) refNamesFromPossiblyUnqualifiedName() ([]*pullRefName, error) { return nil, err } if decomposedImage.hasRegistry { - if i.HasShaInInputName() { + if hasShaInInputName(i.InputName) { imageName = fmt.Sprintf("%s%s", decomposedImage.transport, i.InputName) } else { imageName = decomposedImage.assembleWithTransport() @@ -290,7 +296,7 @@ func (i *Image) refNamesFromPossiblyUnqualifiedName() ([]*pullRefName, error) { image: i.InputName, srcRef: srcRef, } - if i.HasShaInInputName() { + if hasShaInInputName(i.InputName) { ps.dstName = decomposedImage.assemble() } else { ps.dstName = ps.image @@ -305,7 +311,7 @@ func (i *Image) refNamesFromPossiblyUnqualifiedName() ([]*pullRefName, error) { for _, registry := range searchRegistries { decomposedImage.registry = registry imageName := decomposedImage.assembleWithTransport() - if i.HasShaInInputName() { + if hasShaInInputName(i.InputName) { imageName = fmt.Sprintf("%s%s/%s", decomposedImage.transport, registry, i.InputName) } srcRef, err := alltransports.ParseImageName(imageName) |