aboutsummaryrefslogtreecommitdiff
path: root/libpod/image/image.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-06-24 16:25:41 -0400
committerGitHub <noreply@github.com>2020-06-24 16:25:41 -0400
commit0b9143df881f5de0f36f31bc2598e864fdeae7ed (patch)
tree76ed319444ac750d898d06b986adf8341ed605ef /libpod/image/image.go
parent4af2081424c8fa7ac191e9c5231d2429edb8327c (diff)
parent915f8698f4f84fb79cf0438a5b6e4a283e75a7bf (diff)
downloadpodman-0b9143df881f5de0f36f31bc2598e864fdeae7ed.tar.gz
podman-0b9143df881f5de0f36f31bc2598e864fdeae7ed.tar.bz2
podman-0b9143df881f5de0f36f31bc2598e864fdeae7ed.zip
Merge pull request #6758 from mheon/v2.0.1_backports
V2.0.1 backports
Diffstat (limited to 'libpod/image/image.go')
-rw-r--r--libpod/image/image.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/libpod/image/image.go b/libpod/image/image.go
index d81f7e911..83e7467e9 100644
--- a/libpod/image/image.go
+++ b/libpod/image/image.go
@@ -559,15 +559,24 @@ func (i *Image) TagImage(tag string) error {
return nil
}
-// UntagImage removes a tag from the given image
+// UntagImage removes the specified tag from the image.
+// If the tag does not exist, ErrNoSuchTag is returned.
func (i *Image) UntagImage(tag string) error {
if err := i.reloadImage(); err != nil {
return err
}
+
+ // Normalize the tag as we do with TagImage.
+ ref, err := NormalizedTag(tag)
+ if err != nil {
+ return err
+ }
+ tag = ref.String()
+
var newTags []string
tags := i.Names()
if !util.StringInSlice(tag, tags) {
- return nil
+ return errors.Wrapf(ErrNoSuchTag, "%q", tag)
}
for _, t := range tags {
if tag != t {