diff options
author | haircommander <pehunt@redhat.com> | 2018-07-23 12:56:24 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-08 21:04:11 +0000 |
commit | 879453eaf16675f732dd87fd250ccaaac72f4285 (patch) | |
tree | 297b6a1fef1491353a1478ae278386583545fcaa /libpod/image/pull.go | |
parent | 9bd991f477ab2bb4428df6286452516c3deb970e (diff) | |
download | podman-879453eaf16675f732dd87fd250ccaaac72f4285.tar.gz podman-879453eaf16675f732dd87fd250ccaaac72f4285.tar.bz2 podman-879453eaf16675f732dd87fd250ccaaac72f4285.zip |
Fix ambiguity in adding localhost to podman save
...and some naming decisions.
This change ensures podman save doesn't incorrectly prepend localhost when saving an image.
Signed-off-by: haircommander <pehunt@redhat.com>
Closes: #1140
Approved by: rhatdan
Diffstat (limited to 'libpod/image/pull.go')
-rw-r--r-- | libpod/image/pull.go | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go index b4dbe60b2..6c470b552 100644 --- a/libpod/image/pull.go +++ b/libpod/image/pull.go @@ -43,9 +43,9 @@ var ( // and because syntaxes of image names are transport-dependent, the prefix is not really interchangeable; // each user implicitly assumes the appended string is a Docker-like reference. DefaultTransport = DockerTransport + "://" - // DefaultLocalRepo is the default local repository for local image operations + // DefaultLocalRegistry is the default local registry for local image operations // Remote pulls will still use defined registries - DefaultLocalRepo = "localhost" + DefaultLocalRegistry = "localhost" ) // pullRefPair records a pair of prepared image references to pull. @@ -74,12 +74,12 @@ func singlePullRefPairGoal(rp pullRefPair) *pullGoal { } func (ir *Runtime) getPullRefPair(srcRef types.ImageReference, destName string) (pullRefPair, error) { - imgPart, err := decompose(destName) - if err == nil && !imgPart.hasRegistry { + decomposedDest, err := decompose(destName) + if err == nil && !decomposedDest.hasRegistry { // If the image doesn't have a registry, set it as the default repo - imgPart.registry = DefaultLocalRepo - imgPart.hasRegistry = true - destName = imgPart.assemble() + decomposedDest.registry = DefaultLocalRegistry + decomposedDest.hasRegistry = true + destName = decomposedDest.assemble() } reference := destName @@ -179,11 +179,9 @@ func (ir *Runtime) pullGoalFromImageReference(ctx context.Context, srcRef types. case DirTransport: path := srcRef.StringWithinTransport() image := path - // remove leading "/" if image[:1] == "/" { - // Instead of removing the leading /, set localhost as the registry - // so docker.io isn't prepended, and the path becomes the repository - image = DefaultLocalRepo + image + // Set localhost as the registry so docker.io isn't prepended, and the path becomes the repository + image = DefaultLocalRegistry + image } return ir.getSinglePullRefPairGoal(srcRef, image) |