From 9f349528dc75f7b433606438ef2206ae95c7d74e Mon Sep 17 00:00:00 2001 From: umohnani8 Date: Tue, 15 Aug 2017 12:51:07 -0400 Subject: [PATCH] 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 "" Signed-off-by: umohnani8 --- libkpod/image/copy.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/libkpod/image/copy.go b/libkpod/image/copy.go index 7b61dcb6..7b2081a1 100644 --- a/libkpod/image/copy.go +++ b/libkpod/image/copy.go @@ -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 { - images = append(images, manifest[i].RepoTags[0]) + 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