diff options
author | Jhon Honce <jhonce@redhat.com> | 2020-08-05 15:10:12 -0700 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2020-08-20 12:16:53 -0400 |
commit | 35d2db807239eb193edd0d775a95aadb3279f01f (patch) | |
tree | f8aef47737e658a5f574902698ae6e7c2e5460a7 | |
parent | 4f349554adf4811d1081f55c2ba90952c57475e6 (diff) | |
download | podman-35d2db807239eb193edd0d775a95aadb3279f01f.tar.gz podman-35d2db807239eb193edd0d775a95aadb3279f01f.tar.bz2 podman-35d2db807239eb193edd0d775a95aadb3279f01f.zip |
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>
-rw-r--r-- | cmd/podman/images/list.go | 18 | ||||
-rw-r--r-- | test/system/120-load.bats | 2 |
2 files changed, 13 insertions, 7 deletions
diff --git a/cmd/podman/images/list.go b/cmd/podman/images/list.go index ea88b519b..60af5c847 100644 --- a/cmd/podman/images/list.go +++ b/cmd/podman/images/list.go @@ -195,6 +195,7 @@ func sortImages(imageS []*entities.ImageSummary) ([]imageReporter, error) { } else { h.ImageSummary = *e h.Repository = "<none>" + h.Tag = "<none>" imgs = append(imgs, h) } listFlag.readOnly = e.IsReadOnly() @@ -205,27 +206,34 @@ func sortImages(imageS []*entities.ImageSummary) ([]imageReporter, error) { } func tokenRepoTag(ref string) (string, string, error) { - if ref == "<none>:<none>" { return "<none>", "<none>", nil } repo, err := reference.Parse(ref) if err != nil { - return "", "", err + return "<none>", "<none>", err } named, ok := repo.(reference.Named) if !ok { - return ref, "", nil + return ref, "<none>", nil + } + name := named.Name() + if name == "" { + name = "<none>" } tagged, ok := repo.(reference.Tagged) 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 } diff --git a/test/system/120-load.bats b/test/system/120-load.bats index ec959ca73..310ee55de 100644 --- a/test/system/120-load.bats +++ b/test/system/120-load.bats @@ -38,8 +38,6 @@ verify_iid_and_name() { @test "podman load - by image ID" { - skip_if_remote "FIXME: pending #7123" - # FIXME: how to build a simple archive instead? get_iid_and_name |