mirror of
https://github.com/containers/podman.git
synced 2025-06-26 21:07:02 +08:00
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
This commit is contained in:

committed by
Atomic Bot

parent
775eb78f6b
commit
729e72ef48
@ -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?)
|
// nameToPull is a mapping between a resolved source and an expected store destination name (FIXME: clean up somehow?)
|
||||||
type nameToPull struct {
|
type nameToPull struct {
|
||||||
image string
|
image string
|
||||||
srcRef types.ImageReference
|
srcRef types.ImageReference
|
||||||
shaPullName string
|
dstName string
|
||||||
}
|
}
|
||||||
|
|
||||||
// createNamesToPull looks at a decomposed image and determines the possible
|
// createNamesToPull looks at a decomposed image and determines the possible
|
||||||
@ -291,7 +291,9 @@ func (i *Image) createNamesToPull() ([]*pullStruct, error) {
|
|||||||
srcRef: srcRef,
|
srcRef: srcRef,
|
||||||
}
|
}
|
||||||
if i.HasShaInInputName() {
|
if i.HasShaInInputName() {
|
||||||
ps.shaPullName = decomposedImage.assemble()
|
ps.dstName = decomposedImage.assemble()
|
||||||
|
} else {
|
||||||
|
ps.dstName = ps.image
|
||||||
}
|
}
|
||||||
pullNames = append(pullNames, &ps)
|
pullNames = append(pullNames, &ps)
|
||||||
|
|
||||||
@ -314,6 +316,7 @@ func (i *Image) createNamesToPull() ([]*pullStruct, error) {
|
|||||||
image: decomposedImage.assemble(),
|
image: decomposedImage.assemble(),
|
||||||
srcRef: srcRef,
|
srcRef: srcRef,
|
||||||
}
|
}
|
||||||
|
ps.dstName = ps.image
|
||||||
pullNames = append(pullNames, &ps)
|
pullNames = append(pullNames, &ps)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -321,11 +324,7 @@ func (i *Image) createNamesToPull() ([]*pullStruct, error) {
|
|||||||
// Here we construct the destination references
|
// Here we construct the destination references
|
||||||
res := make([]*pullStruct, len(pullNames))
|
res := make([]*pullStruct, len(pullNames))
|
||||||
for j, pStruct := range pullNames {
|
for j, pStruct := range pullNames {
|
||||||
dstName := pStruct.image
|
destRef, err := is.Transport.ParseStoreReference(i.imageruntime.store, pStruct.dstName)
|
||||||
if pStruct.shaPullName != "" {
|
|
||||||
dstName = pStruct.shaPullName
|
|
||||||
}
|
|
||||||
destRef, err := is.Transport.ParseStoreReference(i.imageruntime.store, dstName)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error parsing dest reference name")
|
return nil, errors.Wrapf(err, "error parsing dest reference name")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user