mirror of
https://github.com/containers/podman.git
synced 2025-08-06 03:19:52 +08:00
rework apiv2 wait endpoint|binding
added the ability to wait on a condition (stopped, running, paused...) for a container. if a condition is not provided, wait will default to the stopped condition which uses the original wait code paths. if the condition is stopped, the container exit code will be returned. also, correct a mux issue we discovered. Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
@ -178,7 +178,6 @@ func KillContainer(w http.ResponseWriter, r *http.Request) {
|
||||
func WaitContainer(w http.ResponseWriter, r *http.Request) {
|
||||
exitCode, err := utils.WaitContainer(w, r)
|
||||
if err != nil {
|
||||
utils.InternalServerError(w, err)
|
||||
return
|
||||
}
|
||||
utils.WriteResponse(w, http.StatusOK, strconv.Itoa(int(exitCode)))
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
"github.com/containers/libpod/pkg/api/handlers"
|
||||
"github.com/containers/libpod/pkg/api/handlers/utils"
|
||||
"github.com/containers/libpod/pkg/util"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/gorilla/schema"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
@ -353,7 +352,7 @@ func PodKill(w http.ResponseWriter, r *http.Request) {
|
||||
signal = "SIGKILL"
|
||||
)
|
||||
query := struct {
|
||||
signal string `schema:"signal"`
|
||||
Signal string `schema:"signal"`
|
||||
}{
|
||||
// override any golang type defaults
|
||||
}
|
||||
@ -362,9 +361,8 @@ func PodKill(w http.ResponseWriter, r *http.Request) {
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
muxVars := mux.Vars(r)
|
||||
if _, found := muxVars["signal"]; found {
|
||||
signal = query.signal
|
||||
if _, found := r.URL.Query()["signal"]; found {
|
||||
signal = query.Signal
|
||||
}
|
||||
|
||||
sig, err := util.ParseSignal(signal)
|
||||
|
Reference in New Issue
Block a user