Fix 'kpod load' nil issue raised by QE

When an image is saved using the digest, the repotag saved is null causing load to break
Using the hex form of the image digest to save the image when the repotag is null
This saves the image in containers-storage without a name or tag as "<none>"

Signed-off-by: umohnani8 <umohnani@redhat.com>
This commit is contained in:
umohnani8 2017-08-15 12:51:07 -04:00
parent c067fbbbe2
commit 9f349528dc

View file

@ -134,7 +134,23 @@ func PullImage(store storage.Store, imgName string, allTags, quiet bool, sc *typ
}
// to pull all the images stored in one tar file
for i := range manifest {
if manifest[i].RepoTags != nil {
images = append(images, manifest[i].RepoTags[0])
} else {
// create an image object and use the hex value of the digest as the image ID
// for parsing the store reference
newImg, err := srcRef.NewImage(sc)
if err != nil {
return err
}
defer newImg.Close()
digest := newImg.ConfigInfo().Digest
if err := digest.Validate(); err == nil {
images = append(images, "@"+digest.Hex())
} else {
return errors.Wrapf(err, "error getting config info")
}
}
}
} else if splitArr[0] == "oci" {
// needs to be implemented in future