filters: don't encode empty set. API docs

Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
This commit is contained in:
Vincent Batts 2014-05-30 16:42:37 -04:00
parent 3a4e3ca327
commit 02255ddaa4
3 changed files with 26 additions and 13 deletions

View File

@ -1172,13 +1172,15 @@ func (cli *DockerCli) CmdImages(args ...string) error {
matchName := cmd.Arg(0) matchName := cmd.Arg(0)
// FIXME: --viz and --tree are deprecated. Remove them in a future version. // FIXME: --viz and --tree are deprecated. Remove them in a future version.
if *flViz || *flTree { if *flViz || *flTree {
filterJson, err := filters.ToParam(imageFilterArgs)
if err != nil {
return err
}
v := url.Values{ v := url.Values{
"all": []string{"1"}, "all": []string{"1"},
"filters": []string{filterJson}, }
if len(imageFilterArgs) > 0 {
filterJson, err := filters.ToParam(imageFilterArgs)
if err != nil {
return err
}
v.Set("filters", filterJson)
} }
body, _, err := readBody(cli.call("GET", "/images/json?"+v.Encode(), nil, false)) body, _, err := readBody(cli.call("GET", "/images/json?"+v.Encode(), nil, false))
@ -1242,12 +1244,13 @@ func (cli *DockerCli) CmdImages(args ...string) error {
fmt.Fprintf(cli.out, " base [style=invisible]\n}\n") fmt.Fprintf(cli.out, " base [style=invisible]\n}\n")
} }
} else { } else {
filterJson, err := filters.ToParam(imageFilterArgs) v := url.Values{}
if err != nil { if len(imageFilterArgs) > 0 {
return err filterJson, err := filters.ToParam(imageFilterArgs)
} if err != nil {
v := url.Values{ return err
"filters": []string{filterJson}, }
v.Set("filters", filterJson)
} }
if cmd.NArg() == 1 { if cmd.NArg() == 1 {

View File

@ -712,6 +712,16 @@ Copy files or folders of container `id`
} }
] ]
Query Parameters:
 
- **all** 1/True/true or 0/False/false, default false
- **filters** a json encoded value of the filters (a map[string][]string) to process on the images list.
### Create an image ### Create an image
`POST /images/create` `POST /images/create`

View File

@ -712,7 +712,7 @@ func (srv *Server) Images(job *engine.Job) engine.Status {
} }
} }
if job.GetenvBool("all") && !filt_tagged { if job.GetenvBool("all") && filt_tagged {
allImages, err = srv.daemon.Graph().Map() allImages, err = srv.daemon.Graph().Map()
} else { } else {
allImages, err = srv.daemon.Graph().Heads() allImages, err = srv.daemon.Graph().Heads()