diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2020-09-16 12:12:07 +0200 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2020-09-17 12:23:58 +0200 |
commit | ecae5f7adeb1acea9c090c3d6c43f7470f33ac84 (patch) | |
tree | 5e17fab239a3c698a027733b7eba5ffcb0cacbe1 /cmd/podman | |
parent | 8d7e7954546efb344d677e0c3c86d9d045a3de4f (diff) | |
download | podman-ecae5f7adeb1acea9c090c3d6c43f7470f33ac84.tar.gz podman-ecae5f7adeb1acea9c090c3d6c43f7470f33ac84.tar.bz2 podman-ecae5f7adeb1acea9c090c3d6c43f7470f33ac84.zip |
image list: return all associated names
Always return all associated names / repo tags of an image and fix a bug
with malformed repo tags.
Previously, Podman returned all names only with `--all` but this flag
only instructs to list intermediate images and should not alter
associated names. With `--all` Podman queried the repo tags of an image
which splits all *tagged* names into repository and tag which is then
reassembled to eventually be parsed again in the frontend. Lot's of
redundant CPU heat and buggy as the reassembly didn't consider digests
which ultimately broke parsing in the frontend.
Fixes: #7651
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/images/list.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/cmd/podman/images/list.go b/cmd/podman/images/list.go index 043871a8c..ffb341fc4 100644 --- a/cmd/podman/images/list.go +++ b/cmd/podman/images/list.go @@ -184,13 +184,26 @@ func sortImages(imageS []*entities.ImageSummary) ([]imageReporter, error) { for _, e := range imageS { var h imageReporter if len(e.RepoTags) > 0 { + tagged := []imageReporter{} + untagged := []imageReporter{} for _, tag := range e.RepoTags { h.ImageSummary = *e h.Repository, h.Tag, err = tokenRepoTag(tag) if err != nil { return nil, errors.Wrapf(err, "error parsing repository tag %q:", tag) } - imgs = append(imgs, h) + if h.Tag == "<none>" { + untagged = append(untagged, h) + } else { + tagged = append(tagged, h) + } + } + // Note: we only want to display "<none>" if we + // couldn't find any tagged name in RepoTags. + if len(tagged) > 0 { + imgs = append(imgs, tagged...) + } else { + imgs = append(imgs, untagged[0]) } } else { h.ImageSummary = *e |