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?)
|
||||
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")
|
||||
}
|
||||
|
Reference in New Issue
Block a user