summaryrefslogtreecommitdiff
path: root/libpod/image
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2018-07-27 02:47:43 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-01 18:22:58 +0000
commit7c37b25b4d946855ef4e206f4b017a61f393b942 (patch)
treeecfbc07bf53d1f89e3b9f9087076af82864c1064 /libpod/image
parent6ddf81f07dfc3a30fd426566559352072e9fcd6a (diff)
downloadpodman-7c37b25b4d946855ef4e206f4b017a61f393b942.tar.gz
podman-7c37b25b4d946855ef4e206f4b017a61f393b942.tar.bz2
podman-7c37b25b4d946855ef4e206f4b017a61f393b942.zip
Remove the error return value from getPullRefName
... it is always nil. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com> Closes: #1176 Approved by: rhatdan
Diffstat (limited to 'libpod/image')
-rw-r--r--libpod/image/pull.go29
-rw-r--r--libpod/image/pull_test.go7
2 files changed, 10 insertions, 26 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go
index 6fa036013..97bd2fd7e 100644
--- a/libpod/image/pull.go
+++ b/libpod/image/pull.go
@@ -64,7 +64,7 @@ type pullRefName struct {
dstName string
}
-func getPullRefName(srcRef types.ImageReference, destName string) (*pullRefName, error) {
+func getPullRefName(srcRef types.ImageReference, destName string) *pullRefName {
imgPart, err := decompose(destName)
if err == nil && !imgPart.hasRegistry {
// If the image doesn't have a registry, set it as the default repo
@@ -81,7 +81,7 @@ func getPullRefName(srcRef types.ImageReference, destName string) (*pullRefName,
image: destName,
srcRef: srcRef,
dstName: reference,
- }, nil
+ }
}
// refNamesFromImageReference returns a list of pullRefName for a single ImageReference, depending on the used transport.
@@ -108,10 +108,7 @@ func refNamesFromImageReference(ctx context.Context, srcRef types.ImageReference
if err != nil {
return nil, err
}
- pullInfo, err := getPullRefName(srcRef, reference)
- if err != nil {
- return nil, err
- }
+ pullInfo := getPullRefName(srcRef, reference)
pullNames = append(pullNames, pullInfo)
} else {
var dest []string
@@ -127,10 +124,7 @@ func refNamesFromImageReference(ctx context.Context, srcRef types.ImageReference
}
// Need to load in all the repo tags from the manifest
for _, dst := range dest {
- pullInfo, err := getPullRefName(srcRef, dst)
- if err != nil {
- return nil, err
- }
+ pullInfo := getPullRefName(srcRef, dst)
pullNames = append(pullNames, pullInfo)
}
}
@@ -152,10 +146,7 @@ func refNamesFromImageReference(ctx context.Context, srcRef types.ImageReference
} else {
dest = manifest.Annotations["org.opencontainers.image.ref.name"]
}
- pullInfo, err := getPullRefName(srcRef, dest)
- if err != nil {
- return nil, err
- }
+ pullInfo := getPullRefName(srcRef, dest)
pullNames = append(pullNames, pullInfo)
} else if srcRef.Transport().Name() == DirTransport {
// supports pull from a directory
@@ -166,16 +157,10 @@ func refNamesFromImageReference(ctx context.Context, srcRef types.ImageReference
// so docker.io isn't prepended, and the path becomes the repository
image = DefaultLocalRepo + image
}
- pullInfo, err := getPullRefName(srcRef, image)
- if err != nil {
- return nil, err
- }
+ pullInfo := getPullRefName(srcRef, image)
pullNames = append(pullNames, pullInfo)
} else {
- pullInfo, err := getPullRefName(srcRef, imgName)
- if err != nil {
- return nil, err
- }
+ pullInfo := getPullRefName(srcRef, imgName)
pullNames = append(pullNames, pullInfo)
}
return pullNames, nil
diff --git a/libpod/image/pull_test.go b/libpod/image/pull_test.go
index 9305527d4..1552d568b 100644
--- a/libpod/image/pull_test.go
+++ b/libpod/image/pull_test.go
@@ -72,10 +72,9 @@ func TestGetPullRefName(t *testing.T) {
srcRef, err := alltransports.ParseImageName(c.srcName)
require.NoError(t, err, c.srcName)
- testName := fmt.Sprintf("%#v %#v", c.srcName, c.destName)
- res, err := getPullRefName(srcRef, c.destName)
- require.NoError(t, err, testName)
- assert.Equal(t, &pullRefName{image: c.expectedImage, srcRef: srcRef, dstName: c.expectedDstName}, res, testName)
+ res := getPullRefName(srcRef, c.destName)
+ assert.Equal(t, &pullRefName{image: c.expectedImage, srcRef: srcRef, dstName: c.expectedDstName}, res,
+ fmt.Sprintf("%#v %#v", c.srcName, c.destName))
}
}