summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2018-07-18 23:27:48 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-23 12:44:38 +0000
commit729e72ef484fb7853282184608007bad017ae943 (patch)
tree1092a1c8d915e732c5b46c84507e1e11b8b5ca8f /libpod
parent775eb78f6ba96a19f16e2f96fc7d2ee402049a3b (diff)
downloadpodman-729e72ef484fb7853282184608007bad017ae943.tar.gz
podman-729e72ef484fb7853282184608007bad017ae943.tar.bz2
podman-729e72ef484fb7853282184608007bad017ae943.zip
Replace optional nameToPull.shaPullName with mandatory dstName
This consolidates the shaPullName logic into a single place, (and eliminates the unclear shaPullName member name completely). The resulting nameToPull will shortly be more generally useful. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com> Closes: #1112 Approved by: rhatdan
Diffstat (limited to 'libpod')
-rw-r--r--libpod/image/pull.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go
index f1bfac2a3..c9bcb19e5 100644
--- a/libpod/image/pull.go
+++ b/libpod/image/pull.go
@@ -259,9 +259,9 @@ func (i *Image) pullImage(ctx context.Context, writer io.Writer, authfile, signa
// nameToPull is a mapping between a resolved source and an expected store destination name (FIXME: clean up somehow?)
type nameToPull struct {
- image string
- srcRef types.ImageReference
- shaPullName string
+ image string
+ srcRef types.ImageReference
+ dstName string
}
// createNamesToPull looks at a decomposed image and determines the possible
@@ -291,7 +291,9 @@ func (i *Image) createNamesToPull() ([]*pullStruct, error) {
srcRef: srcRef,
}
if i.HasShaInInputName() {
- ps.shaPullName = decomposedImage.assemble()
+ ps.dstName = decomposedImage.assemble()
+ } else {
+ ps.dstName = ps.image
}
pullNames = append(pullNames, &ps)
@@ -314,6 +316,7 @@ func (i *Image) createNamesToPull() ([]*pullStruct, error) {
image: decomposedImage.assemble(),
srcRef: srcRef,
}
+ ps.dstName = ps.image
pullNames = append(pullNames, &ps)
}
}
@@ -321,11 +324,7 @@ func (i *Image) createNamesToPull() ([]*pullStruct, error) {
// Here we construct the destination references
res := make([]*pullStruct, len(pullNames))
for j, pStruct := range pullNames {
- dstName := pStruct.image
- if pStruct.shaPullName != "" {
- dstName = pStruct.shaPullName
- }
- destRef, err := is.Transport.ParseStoreReference(i.imageruntime.store, dstName)
+ destRef, err := is.Transport.ParseStoreReference(i.imageruntime.store, pStruct.dstName)
if err != nil {
return nil, errors.Wrapf(err, "error parsing dest reference name")
}