mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-06 13:41:36 +00:00
Revert rm -f deprecation use SIGKILL instead
`rm -f` was originally deprecated in favor of `rm --stop/--kill` since `rm -f` was sending SIGTERM and potentially very slow. Instead this will bring back `rm -f` but use SIGKILL isntead Docker-DCO-1.1-Signed-off-by: Brian Goff <cpuguy83@gmail.com> (github: cpuguy83)
This commit is contained in:
@@ -680,16 +680,8 @@ func deleteContainers(eng *engine.Engine, version version.Version, w http.Respon
|
||||
}
|
||||
job := eng.Job("delete", vars["name"])
|
||||
|
||||
if version.GreaterThanOrEqualTo("1.14") {
|
||||
job.Setenv("stop", r.Form.Get("stop"))
|
||||
job.Setenv("kill", r.Form.Get("kill"))
|
||||
job.Setenv("forceRemove", r.Form.Get("force"))
|
||||
|
||||
if job.GetenvBool("stop") && job.GetenvBool("kill") {
|
||||
return fmt.Errorf("Bad parameters: can't use stop and kill simultaneously")
|
||||
}
|
||||
} else {
|
||||
job.Setenv("stop", r.Form.Get("force"))
|
||||
}
|
||||
job.Setenv("removeVolume", r.Form.Get("v"))
|
||||
job.Setenv("removeLink", r.Form.Get("link"))
|
||||
if err := job.Run(); err != nil {
|
||||
|
||||
@@ -474,30 +474,6 @@ func TestDeleteContainers(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeleteContainersWithStopAndKill(t *testing.T) {
|
||||
if api.APIVERSION.LessThan("1.14") {
|
||||
return
|
||||
}
|
||||
eng := engine.New()
|
||||
var called bool
|
||||
eng.Register("delete", func(job *engine.Job) engine.Status {
|
||||
called = true
|
||||
return engine.StatusOK
|
||||
})
|
||||
r := serveRequest("DELETE", "/containers/foo?stop=1&kill=1", nil, eng, t)
|
||||
if r.Code != http.StatusBadRequest {
|
||||
t.Fatalf("Got status %d, expected %d", r.Code, http.StatusBadRequest)
|
||||
}
|
||||
if called {
|
||||
t.Fatalf("container_delete jobs was called, but it shouldn't")
|
||||
}
|
||||
res := strings.TrimSpace(r.Body.String())
|
||||
expected := "Bad parameters: can't use stop and kill simultaneously"
|
||||
if !strings.Contains(res, expected) {
|
||||
t.Fatalf("Output %s, expected %s in it", res, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func serveRequest(method, target string, body io.Reader, eng *engine.Engine, t *testing.T) *httptest.ResponseRecorder {
|
||||
return serveRequestUsingVersion(method, target, api.APIVERSION, body, eng, t)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user