diff options
author | Brent Baude <bbaude@redhat.com> | 2020-04-27 15:28:01 -0500 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2020-04-27 16:12:06 -0500 |
commit | e78e66c5b9a103f577df155b3f61130cfc718d0f (patch) | |
tree | 89f7396afc56d5fc09f28bbf2f42dec9167d277f /cmd/podman/volumes/list.go | |
parent | f6f71724949c22cf89a44015c29bd5a144db7390 (diff) | |
download | podman-e78e66c5b9a103f577df155b3f61130cfc718d0f.tar.gz podman-e78e66c5b9a103f577df155b3f61130cfc718d0f.tar.bz2 podman-e78e66c5b9a103f577df155b3f61130cfc718d0f.zip |
enable volume integration tests
enabled integration tests for volumes. there are two exceptions that still need work because of something not yet implemented.
also, add code to deal with the fact that containers conf appears to set a local volume driver where it used to be simply blank.
Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/volumes/list.go')
-rw-r--r-- | cmd/podman/volumes/list.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cmd/podman/volumes/list.go b/cmd/podman/volumes/list.go index f75de6b4b..7f5a55b14 100644 --- a/cmd/podman/volumes/list.go +++ b/cmd/podman/volumes/list.go @@ -2,6 +2,7 @@ package volumes import ( "context" + "fmt" "html/template" "io" "os" @@ -57,6 +58,9 @@ func list(cmd *cobra.Command, args []string) error { if cliOpts.Quiet && cmd.Flag("format").Changed { return errors.New("quiet and format flags cannot be used together") } + if len(cliOpts.Filter) > 0 { + lsOpts.Filter = make(map[string][]string) + } for _, f := range cliOpts.Filter { filterSplit := strings.Split(f, "=") if len(filterSplit) < 2 { @@ -68,6 +72,10 @@ func list(cmd *cobra.Command, args []string) error { if err != nil { return err } + if cliOpts.Format == "json" { + return outputJSON(responses) + } + if len(responses) < 1 { return nil } @@ -99,3 +107,12 @@ func list(cmd *cobra.Command, args []string) error { } return nil } + +func outputJSON(vols []*entities.VolumeListReport) error { + b, err := json.MarshalIndent(vols, "", " ") + if err != nil { + return err + } + fmt.Println(string(b)) + return nil +} |