Pass HTTP params through when forwarding `containers` job

This commit is contained in:
Aanand Prasad 2014-05-15 14:45:00 +01:00
parent f6f3cd3181
commit a799e0fe20
1 changed files with 9 additions and 1 deletions

View File

@ -26,7 +26,15 @@ func (f *forwarder) Install(eng *engine.Engine) error {
return job.Errorf("%v", err)
}
job.Eng.Register("containers", func(job *engine.Job) engine.Status {
resp, err := client.call("GET", "/containers/json?all=1", "")
path := fmt.Sprintf(
"/containers/json?all=%s&size=%s&since=%s&before=%s&limit=%s",
url.QueryEscape(job.Getenv("all")),
url.QueryEscape(job.Getenv("size")),
url.QueryEscape(job.Getenv("since")),
url.QueryEscape(job.Getenv("before")),
url.QueryEscape(job.Getenv("limit")),
)
resp, err := client.call("GET", path, "")
if err != nil {
return job.Errorf("%s: get: %v", client.URL.String(), err)
}