summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorDivyansh Kamboj <kambojdivyansh2000@gmail.com>2019-06-03 17:52:43 +0530
committerDivyansh Kamboj <kambojdivyansh2000@gmail.com>2019-06-04 17:54:07 +0530
commitef1a025356deae1535bb6240cdf6afe995768eb1 (patch)
tree3dcccabf7fdc3d0cec5b1dbf4f7e8743f56a1e81 /libpod
parent0ede794da91329ecc5a24c66924ce84023f237f9 (diff)
downloadpodman-ef1a025356deae1535bb6240cdf6afe995768eb1.tar.gz
podman-ef1a025356deae1535bb6240cdf6afe995768eb1.tar.bz2
podman-ef1a025356deae1535bb6240cdf6afe995768eb1.zip
Add warning while untagging an image podman-load
Signed-off-by: Divyansh Kamboj <kambojdivyansh2000@gmail.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/image/pull.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go
index cb7411ce5..644a9ae86 100644
--- a/libpod/image/pull.go
+++ b/libpod/image/pull.go
@@ -149,6 +149,13 @@ func (ir *Runtime) pullGoalFromImageReference(ctx context.Context, srcRef types.
// Need to load in all the repo tags from the manifest
res := []pullRefPair{}
for _, dst := range manifest[0].RepoTags {
+ //check if image exists and gives a warning of untagging
+ localImage, err := ir.NewFromLocal(dst)
+ imageID := strings.TrimSuffix(manifest[0].Config, ".json")
+ if err == nil && imageID != localImage.ID() {
+ logrus.Errorf("the image %s already exists, renaming the old one with ID %s to empty string", dst, localImage.ID())
+ }
+
pullInfo, err := ir.getPullRefPair(srcRef, dst)
if err != nil {
return nil, err
@@ -168,7 +175,6 @@ func (ir *Runtime) pullGoalFromImageReference(ctx context.Context, srcRef types.
if err != nil {
return nil, errors.Wrapf(err, "error loading manifest for %q", srcRef)
}
-
var dest string
if manifest.Annotations == nil || manifest.Annotations["org.opencontainers.image.ref.name"] == "" {
// If the input image has no image.ref.name, we need to feed it a dest anyways