Skip to content

Commit

Permalink
Merge pull request containers#8392 from jwhonce/wip/report
Browse files Browse the repository at this point in the history
Fix `podman images...` missing headers in table templates
  • Loading branch information
openshift-merge-robot authored Dec 2, 2020
2 parents 2e55543 + 2a02833 commit d456765
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cmd/podman/images/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
13 changes: 10 additions & 3 deletions test/system/010-images.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d456765

Please sign in to comment.