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)
// FIXME: --viz and --tree are deprecated. Remove them in a future version.
if *flViz || *flTree {
filterJson, err := filters.ToParam(imageFilterArgs)
if err != nil {
return err
}
v := url.Values{
"all": []string{"1"},
"filters": []string{filterJson},
"all": []string{"1"},
}
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))
@ -1242,12 +1244,13 @@ func (cli *DockerCli) CmdImages(args ...string) error {
fmt.Fprintf(cli.out, " base [style=invisible]\n}\n")
}
} else {
filterJson, err := filters.ToParam(imageFilterArgs)
if err != nil {
return err
}
v := url.Values{
"filters": []string{filterJson},
v := url.Values{}
if len(imageFilterArgs) > 0 {
filterJson, err := filters.ToParam(imageFilterArgs)
if err != nil {
return err
}
v.Set("filters", filterJson)
}
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
`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()
} else {
allImages, err = srv.daemon.Graph().Heads()