Skip to content

Add warning while untagging an image podman-load#3257

Merged
openshift-merge-robot merged 1 commit intocontainers:masterfrom
weirdwiz:load
Jun 17, 2019
Merged

Add warning while untagging an image podman-load#3257
openshift-merge-robot merged 1 commit intocontainers:masterfrom
weirdwiz:load

Conversation

@weirdwiz
Copy link
Copy Markdown
Collaborator

@weirdwiz weirdwiz commented Jun 4, 2019

Adds a warning if another image with the same name exists and is going to be untagged

fixes #2821

@rh-atomic-bot
Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?
I understand the following commands:

  • bot, add author to whitelist
  • bot, test pull request
  • bot, test pull request once

Signed-off-by: Divyansh Kamboj <kambojdivyansh2000@gmail.com>
@baude
Copy link
Copy Markdown
Member

baude commented Jun 4, 2019

/approve

@openshift-ci-robot
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: baude, weirdwiz

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@baude
Copy link
Copy Markdown
Member

baude commented Jun 4, 2019

bot, test pull request

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 4, 2019
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())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest rewording - `"tag %s already exists, untagging but not deleting old image"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, but you'd want to keep the ID in there... maybe tag %s already exists as ID %s, untagging but not deleting old image?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

untagging would mean removing the tag, maybe I could reword it to
tag %s already exists as ID %s, tagging the old image as an empty string

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Back to my original point, unless I'm being oblivious, this code is not actually tagging the old image as an empty string is it? I think in this message you need to tell the user what action they need to do as we're not doing it for them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're specifically retagging as empty string? I think internally that's considered an untag of the old image... @baude that sound right to you?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internally this set's the name of the image image.Names = stringSliceWithoutValue(image.Names, name) in the file https://github.com/containers/storage/blob/master/images.go .

The thing that is confusing me is that if I do podman rmi imagename then if the image exists with another tag then it simply gets untagged and is not visible when I run podman images, but in this case, the image is visible in podman images as <none> .

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...Could this be the dreaded literal tag returning... Let me poke around

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())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"renaming" implies the software is in the process of changing the images name which doesn't seem to be happening?
Perhaps:
"the image %s already exists, rename the image with ID %s to another value and retry"

There's probably a better way to say the above, but that's all I got after one cup of tea.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker only gives this warning and continues to untag it, so I only added the warning

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Jun 8, 2019

@mheon @TomSweeneyRedHat @baude Where do we stand on this PR?

@mheon
Copy link
Copy Markdown
Member

mheon commented Jun 8, 2019 via email

@TomSweeneyRedHat
Copy link
Copy Markdown
Member

The error message still needs to change IMO. The message implies that the code is changing something when AFAIKS, it's only reporting an issue. The code other than the message is fine.

@weirdwiz
Copy link
Copy Markdown
Collaborator Author

weirdwiz commented Jun 9, 2019

@TomSweeneyRedHat AFAIK the code does remove the name of the image with the same name but a different ID as the image loaded. I am unsure whether it should be called untagging, or renaming to something empty.

@TomSweeneyRedHat
Copy link
Copy Markdown
Member

If @mheon is happy with the messaging, then it's fine by me, But unless I'm missing the functionality of the code (very possible), I think it's a misleading message.

@mheon
Copy link
Copy Markdown
Member

mheon commented Jun 17, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 17, 2019
@openshift-merge-robot openshift-merge-robot merged commit 6ee0f3e into containers:master Jun 17, 2019
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 26, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: loading multiple images corrupts tags of existing ones

8 participants