summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-12-02 20:25:54 +0100
committerGitHub <noreply@github.com>2020-12-02 20:25:54 +0100
commitd45676549d67033364f6777765054073036cfc32 (patch)
treeb5b821f988f6ee6a78919d48824dc66f90e525bd
parent2e55543ccab5ece6b005dbbc026774b9e0de665c (diff)
parent2a02833e9fe533d3e3c6bb05edeec769638a18af (diff)
downloadpodman-d45676549d67033364f6777765054073036cfc32.tar.gz
podman-d45676549d67033364f6777765054073036cfc32.tar.bz2
podman-d45676549d67033364f6777765054073036cfc32.zip
Merge pull request #8392 from jwhonce/wip/report
Fix `podman images...` missing headers in table templates
-rw-r--r--cmd/podman/images/list.go4
-rw-r--r--test/e2e/images_test.go2
-rw-r--r--test/system/010-images.bats13
3 files changed, 13 insertions, 6 deletions
diff --git a/cmd/podman/images/list.go b/cmd/podman/images/list.go
index bcb31e6ee..8a7951923 100644
--- a/cmd/podman/images/list.go
+++ b/cmd/podman/images/list.go
@@ -126,8 +126,8 @@ func images(cmd *cobra.Command, args []string) error {
case listFlag.quiet:
return writeID(imgs)
default:
- if cmd.Flag("format").Changed {
- listFlag.noHeading = true // V1 compatibility
+ if cmd.Flags().Changed("format") && !parse.HasTable(listFlag.format) {
+ listFlag.noHeading = true
}
return writeTemplate(imgs)
}
diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go
index b69d2597e..281b2c313 100644
--- a/test/e2e/images_test.go
+++ b/test/e2e/images_test.go
@@ -278,7 +278,7 @@ WORKDIR /test
It("podman images sort by values", func() {
sortValueTest := func(value string, result int, format string) []string {
f := fmt.Sprintf("{{.%s}}", format)
- session := podmanTest.Podman([]string{"images", "--sort", value, "--format", f})
+ session := podmanTest.Podman([]string{"images", "--noheading", "--sort", value, "--format", f})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(result))
diff --git a/test/system/010-images.bats b/test/system/010-images.bats
index ee6da30ec..76caf282b 100644
--- a/test/system/010-images.bats
+++ b/test/system/010-images.bats
@@ -199,9 +199,16 @@ Labels.created_at | 20[0-9-]\\\+T[0-9:]\\\+Z
local format=$2
run_podman images --sort repository --format "$format"
- _check_line 0 ${aaa_name} ${aaa_tag}
- _check_line 1 "${PODMAN_TEST_IMAGE_REGISTRY}/${PODMAN_TEST_IMAGE_USER}/${PODMAN_TEST_IMAGE_NAME}" "${PODMAN_TEST_IMAGE_TAG}"
- _check_line 2 ${zzz_name} ${zzz_tag}
+
+ line_no=0
+ if [[ $format == table* ]]; then
+ # skip headers from table command
+ line_no=1
+ fi
+
+ _check_line $line_no ${aaa_name} ${aaa_tag}
+ _check_line $((line_no+1)) "${PODMAN_TEST_IMAGE_REGISTRY}/${PODMAN_TEST_IMAGE_USER}/${PODMAN_TEST_IMAGE_NAME}" "${PODMAN_TEST_IMAGE_TAG}"
+ _check_line $((line_no+2)) ${zzz_name} ${zzz_tag}
}
# Begin the test: tag $IMAGE with both the given names