From c2a1138aecc2a0b3f60e3a61c0dfe18de3a47684 Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Fri, 17 Apr 2020 13:20:36 -0500 Subject: enable integration testing Signed-off-by: Brent Baude --- cmd/podman/volumes/inspect.go | 7 ++++++- cmd/podman/volumes/list.go | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/podman/volumes/inspect.go b/cmd/podman/volumes/inspect.go index 57e773aef..feaaee176 100644 --- a/cmd/podman/volumes/inspect.go +++ b/cmd/podman/volumes/inspect.go @@ -5,6 +5,7 @@ import ( "fmt" "html/template" "os" + "strings" "github.com/containers/buildah/pkg/formats" "github.com/containers/libpod/cmd/podman/registry" @@ -61,7 +62,11 @@ func inspect(cmd *cobra.Command, args []string) error { } fmt.Println(string(jsonOut)) default: - tmpl, err := template.New("volumeInspect").Parse(inspectFormat) + if !strings.HasSuffix(inspectFormat, "\n") { + inspectFormat += "\n" + } + format := "{{range . }}" + inspectFormat + "{{end}}" + tmpl, err := template.New("volumeInspect").Parse(format) if err != nil { return err } diff --git a/cmd/podman/volumes/list.go b/cmd/podman/volumes/list.go index fd89db01f..f75de6b4b 100644 --- a/cmd/podman/volumes/list.go +++ b/cmd/podman/volumes/list.go @@ -68,6 +68,9 @@ func list(cmd *cobra.Command, args []string) error { if err != nil { return err } + if len(responses) < 1 { + return nil + } // "\t" from the command line is not being recognized as a tab // replacing the string "\t" to a tab character if the user passes in "\t" cliOpts.Format = strings.Replace(cliOpts.Format, `\t`, "\t", -1) -- cgit v1.2.3-54-g00ecf