Remove job from stop

Signed-off-by: Antonio Murdaca <me@runcom.ninja>
This commit is contained in:
Antonio Murdaca
2015-04-12 00:41:16 +02:00
parent e3dd323336
commit 04cc6c6aa4
3 changed files with 12 additions and 21 deletions
+9 -3
View File
@@ -988,9 +988,14 @@ func postContainersStop(eng *engine.Engine, version version.Version, w http.Resp
if vars == nil {
return fmt.Errorf("Missing parameter")
}
job := eng.Job("stop", vars["name"])
job.Setenv("t", r.Form.Get("t"))
if err := job.Run(); err != nil {
d := getDaemon(eng)
seconds, err := strconv.Atoi(r.Form.Get("t"))
if err != nil {
return err
}
if err := d.ContainerStop(vars["name"], seconds); err != nil {
if err.Error() == "Container already stopped" {
w.WriteHeader(http.StatusNotModified)
return nil
@@ -998,6 +1003,7 @@ func postContainersStop(eng *engine.Engine, version version.Version, w http.Resp
return err
}
w.WriteHeader(http.StatusNoContent)
return nil
}