summaryrefslogtreecommitdiff
path: root/libpod/image
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2018-07-27 02:56:57 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-01 18:22:58 +0000
commitecc1db39b53e0566aed7de7192db916cf44a9fcb (patch)
treec5c3d0ea5b884ffae179124e9dad3344c9feec0c /libpod/image
parent24da27c3e9606994cc97821c9025565b5a4bf25d (diff)
downloadpodman-ecc1db39b53e0566aed7de7192db916cf44a9fcb.tar.gz
podman-ecc1db39b53e0566aed7de7192db916cf44a9fcb.tar.bz2
podman-ecc1db39b53e0566aed7de7192db916cf44a9fcb.zip
Use srcRef.StringWithinTransport() instead of parsing imgName again
Because srcRef is created by parsing imgName, both hard-code assumptions about transport-specific formats of the strings, so that is neither better nor worse; but we do less explicit parsing. Should not change behavior for dir:, nor for fully-correct docker-archive:. docker-archive:, though, also supports docker-archive:path:reference, where the reference is ignored (with a warning) on read; in such cases the previous code would use the reference only (not the path), the new code uses both as the path. Neither works, we just change the failure mode (but "error opening path:reference" is now more suggestive of the correct usage). Signed-off-by: Miloslav Trmač <mitr@redhat.com> Closes: #1176 Approved by: rhatdan
Diffstat (limited to 'libpod/image')
-rw-r--r--libpod/image/pull.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go
index 49a834391..b17b4434d 100644
--- a/libpod/image/pull.go
+++ b/libpod/image/pull.go
@@ -87,13 +87,12 @@ func getPullRefName(srcRef types.ImageReference, destName string) *pullRefName {
// refNamesFromImageReference returns a list of pullRefName for a single ImageReference, depending on the used transport.
func refNamesFromImageReference(ctx context.Context, srcRef types.ImageReference, imgName string, sc *types.SystemContext) ([]*pullRefName, error) {
var pullNames []*pullRefName
- splitArr := strings.Split(imgName, ":")
- archFile := splitArr[len(splitArr)-1]
// supports pulling from docker-archive, oci, and registries
switch srcRef.Transport().Name() {
case DockerArchive:
- tarSource, err := tarfile.NewSourceFromFile(archFile)
+ archivePath := srcRef.StringWithinTransport()
+ tarSource, err := tarfile.NewSourceFromFile(archivePath)
if err != nil {
return nil, err
}
@@ -150,8 +149,8 @@ func refNamesFromImageReference(ctx context.Context, srcRef types.ImageReference
pullInfo := getPullRefName(srcRef, dest)
pullNames = append(pullNames, pullInfo)
case DirTransport:
- // supports pull from a directory
- image := splitArr[1]
+ path := srcRef.StringWithinTransport()
+ image := path
// remove leading "/"
if image[:1] == "/" {
// Instead of removing the leading /, set localhost as the registry