mirror of
https://github.com/containers/podman.git
synced 2025-08-01 04:42:20 +08:00
Default .Repository and .Tag values to <none>
Refactor the processing of Repository and Tag fields to default to <none> when printing via --format flag. Previously, the default format would print <none> but --format {{.Tag}} would not in some cases. Fixes #7123 Signed-off-by: Jhon Honce <jhonce@redhat.com>
This commit is contained in:
@ -195,6 +195,7 @@ func sortImages(imageS []*entities.ImageSummary) ([]imageReporter, error) {
|
|||||||
} else {
|
} else {
|
||||||
h.ImageSummary = *e
|
h.ImageSummary = *e
|
||||||
h.Repository = "<none>"
|
h.Repository = "<none>"
|
||||||
|
h.Tag = "<none>"
|
||||||
imgs = append(imgs, h)
|
imgs = append(imgs, h)
|
||||||
}
|
}
|
||||||
listFlag.readOnly = e.IsReadOnly()
|
listFlag.readOnly = e.IsReadOnly()
|
||||||
@ -205,27 +206,34 @@ func sortImages(imageS []*entities.ImageSummary) ([]imageReporter, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func tokenRepoTag(ref string) (string, string, error) {
|
func tokenRepoTag(ref string) (string, string, error) {
|
||||||
|
|
||||||
if ref == "<none>:<none>" {
|
if ref == "<none>:<none>" {
|
||||||
return "<none>", "<none>", nil
|
return "<none>", "<none>", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
repo, err := reference.Parse(ref)
|
repo, err := reference.Parse(ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return "<none>", "<none>", err
|
||||||
}
|
}
|
||||||
|
|
||||||
named, ok := repo.(reference.Named)
|
named, ok := repo.(reference.Named)
|
||||||
if !ok {
|
if !ok {
|
||||||
return ref, "", nil
|
return ref, "<none>", nil
|
||||||
|
}
|
||||||
|
name := named.Name()
|
||||||
|
if name == "" {
|
||||||
|
name = "<none>"
|
||||||
}
|
}
|
||||||
|
|
||||||
tagged, ok := repo.(reference.Tagged)
|
tagged, ok := repo.(reference.Tagged)
|
||||||
if !ok {
|
if !ok {
|
||||||
return named.Name(), "", nil
|
return name, "<none>", nil
|
||||||
|
}
|
||||||
|
tag := tagged.Tag()
|
||||||
|
if tag == "" {
|
||||||
|
tag = "<none>"
|
||||||
}
|
}
|
||||||
|
|
||||||
return named.Name(), tagged.Tag(), nil
|
return name, tag, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,8 +28,6 @@ verify_iid_and_name() {
|
|||||||
|
|
||||||
|
|
||||||
@test "podman load - by image ID" {
|
@test "podman load - by image ID" {
|
||||||
skip_if_remote "FIXME: pending #7123"
|
|
||||||
|
|
||||||
# FIXME: how to build a simple archive instead?
|
# FIXME: how to build a simple archive instead?
|
||||||
get_iid_and_name
|
get_iid_and_name
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user