mirror of https://github.com/containers/podman.git
Parameters for ExecStart are body, not query
Oops. Misread the docs when I initially implemented this. Nice and easy fix, at least. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
parent
0f0abe2909
commit
08d04c2e05
|
|
@ -159,33 +159,23 @@ func ExecResizeHandler(w http.ResponseWriter, r *http.Request) {
|
|||
// ExecStartHandler runs a given exec session.
|
||||
func ExecStartHandler(w http.ResponseWriter, r *http.Request) {
|
||||
runtime := r.Context().Value("runtime").(*libpod.Runtime)
|
||||
decoder := r.Context().Value("decoder").(*schema.Decoder)
|
||||
|
||||
sessionID := mux.Vars(r)["id"]
|
||||
|
||||
// TODO: Need to support these
|
||||
query := struct {
|
||||
Detach bool `schema:"Detach"`
|
||||
Tty bool `schema:"Tty"`
|
||||
}{
|
||||
// override any golang type defaults
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
// TODO: We should read/support Tty and Detach from here.
|
||||
bodyParams := new(handlers.ExecStartConfig)
|
||||
|
||||
if err := json.NewDecoder(r.Body).Decode(&bodyParams); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to decode parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
if _, found := r.URL.Query()["Detach"]; found {
|
||||
if bodyParams.Detach == true {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Errorf("Detached exec is not yet supported"))
|
||||
return
|
||||
}
|
||||
if _, found := r.URL.Query()["Tty"]; found {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Errorf("overriding terminal setting in ExecStart is not yet supported"))
|
||||
return
|
||||
}
|
||||
// TODO: Verify TTY setting against what inspect session was made with
|
||||
|
||||
sessionCtr, err := runtime.GetExecSessionContainer(sessionID)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -170,6 +170,11 @@ type ExecCreateResponse struct {
|
|||
docker.IDResponse
|
||||
}
|
||||
|
||||
type ExecStartConfig struct {
|
||||
Detach bool `json:"Detach"`
|
||||
Tty bool `json:"Tty"`
|
||||
}
|
||||
|
||||
func ImageToImageSummary(l *libpodImage.Image) (*entities.ImageSummary, error) {
|
||||
containers, err := l.Containers()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue