mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00
Add bindings for exec and enable attached remote
This adds bindings for starting exec sessions, and then uses them to wire up detached exec. Code is heavily based on Attach code for containers, slightly modified to handle exec sessions. Bindings are presently attached-only, detached is pending on a Conmon update landing in CI. I'll probably get to that next. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:

committed by
Matthew Heon

parent
990514ea92
commit
45a7e7266e
@ -8,6 +8,7 @@ import (
|
||||
"github.com/containers/libpod/libpod"
|
||||
"github.com/containers/libpod/libpod/define"
|
||||
"github.com/containers/libpod/pkg/api/handlers/utils"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/gorilla/schema"
|
||||
"github.com/pkg/errors"
|
||||
"k8s.io/client-go/tools/remotecommand"
|
||||
@ -37,9 +38,9 @@ func ResizeTTY(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
var status int
|
||||
name := utils.GetName(r)
|
||||
switch {
|
||||
case strings.Contains(r.URL.Path, "/containers/"):
|
||||
name := utils.GetName(r)
|
||||
ctnr, err := runtime.LookupContainer(name)
|
||||
if err != nil {
|
||||
utils.ContainerNotFound(w, name, err)
|
||||
@ -61,6 +62,7 @@ func ResizeTTY(w http.ResponseWriter, r *http.Request) {
|
||||
// reasons.
|
||||
status = http.StatusOK
|
||||
case strings.Contains(r.URL.Path, "/exec/"):
|
||||
name := mux.Vars(r)["id"]
|
||||
ctnr, err := runtime.GetExecSessionContainer(name)
|
||||
if err != nil {
|
||||
utils.SessionNotFound(w, name, err)
|
||||
|
Reference in New Issue
Block a user