summaryrefslogtreecommitdiff
path: root/libpod/image/utils.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-01-14 01:08:13 -0800
committerGitHub <noreply@github.com>2019-01-14 01:08:13 -0800
commit264d0821068c26daae9b2e57bb8ea34dac79e62a (patch)
tree854b66b38db0ef397c9b0911cbf95da7f2849b48 /libpod/image/utils.go
parent140ae25c4d0c7ba89a0bb7ae16f81f90d20be535 (diff)
parent449116af19305a567933effaced5a0a21a8c71be (diff)
downloadpodman-264d0821068c26daae9b2e57bb8ea34dac79e62a.tar.gz
podman-264d0821068c26daae9b2e57bb8ea34dac79e62a.tar.bz2
podman-264d0821068c26daae9b2e57bb8ea34dac79e62a.zip
Merge pull request #2117 from mtrmac/no-imageParts
RFC: Mostly replace imageParts
Diffstat (limited to 'libpod/image/utils.go')
-rw-r--r--libpod/image/utils.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/libpod/image/utils.go b/libpod/image/utils.go
index 135b47008..ad027f32a 100644
--- a/libpod/image/utils.go
+++ b/libpod/image/utils.go
@@ -16,7 +16,8 @@ import (
// findImageInRepotags takes an imageParts struct and searches images' repotags for
// a match on name:tag
-func findImageInRepotags(search Parts, images []*Image) (*storage.Image, error) {
+func findImageInRepotags(search imageParts, images []*Image) (*storage.Image, error) {
+ _, searchName, searchSuspiciousTagValueForSearch := search.suspiciousRefNameTagValuesForSearch()
var results []*storage.Image
for _, image := range images {
for _, name := range image.Names() {
@@ -25,21 +26,22 @@ func findImageInRepotags(search Parts, images []*Image) (*storage.Image, error)
if err != nil {
continue
}
- if d.name == search.name && d.Tag == search.Tag {
+ _, dName, dSuspiciousTagValueForSearch := d.suspiciousRefNameTagValuesForSearch()
+ if dName == searchName && dSuspiciousTagValueForSearch == searchSuspiciousTagValueForSearch {
results = append(results, image.image)
continue
}
// account for registry:/somedir/image
- if strings.HasSuffix(d.name, search.name) && d.Tag == search.Tag {
+ if strings.HasSuffix(dName, searchName) && dSuspiciousTagValueForSearch == searchSuspiciousTagValueForSearch {
results = append(results, image.image)
continue
}
}
}
if len(results) == 0 {
- return &storage.Image{}, errors.Errorf("unable to find a name and tag match for %s in repotags", search.name)
+ return &storage.Image{}, errors.Errorf("unable to find a name and tag match for %s in repotags", searchName)
} else if len(results) > 1 {
- return &storage.Image{}, errors.Errorf("found multiple name and tag matches for %s in repotags", search.name)
+ return &storage.Image{}, errors.Errorf("found multiple name and tag matches for %s in repotags", searchName)
}
return results[0], nil
}