mirror of
https://github.com/containers/podman.git
synced 2025-06-19 16:33:24 +08:00
Add warning while untagging an image podman-load
Signed-off-by: Divyansh Kamboj <kambojdivyansh2000@gmail.com>
This commit is contained in:
@ -149,6 +149,13 @@ func (ir *Runtime) pullGoalFromImageReference(ctx context.Context, srcRef types.
|
|||||||
// Need to load in all the repo tags from the manifest
|
// Need to load in all the repo tags from the manifest
|
||||||
res := []pullRefPair{}
|
res := []pullRefPair{}
|
||||||
for _, dst := range manifest[0].RepoTags {
|
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)
|
pullInfo, err := ir.getPullRefPair(srcRef, dst)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -168,7 +175,6 @@ func (ir *Runtime) pullGoalFromImageReference(ctx context.Context, srcRef types.
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error loading manifest for %q", srcRef)
|
return nil, errors.Wrapf(err, "error loading manifest for %q", srcRef)
|
||||||
}
|
}
|
||||||
|
|
||||||
var dest string
|
var dest string
|
||||||
if manifest.Annotations == nil || manifest.Annotations["org.opencontainers.image.ref.name"] == "" {
|
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
|
// If the input image has no image.ref.name, we need to feed it a dest anyways
|
||||||
|
Reference in New Issue
Block a user