mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 01:31:17 +00:00
Disable pipes endpoint, we are going for controls instead
This commit is contained in:
committed by
Simon Howe
parent
c2f2a90b61
commit
403b70dde8
47
app/pipes.go
47
app/pipes.go
@@ -2,7 +2,6 @@ package app
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/gorilla/mux"
|
||||
@@ -18,11 +17,6 @@ func RegisterPipeRoutes(router *mux.Router, pr PipeRouter) {
|
||||
Path("/api/pipe/{pipeID}/check").
|
||||
HandlerFunc(requestContextDecorator(checkPipe(pr)))
|
||||
|
||||
router.Methods("POST").
|
||||
Name("api_pipe_pipeid_resize_tty").
|
||||
Path("/api/pipe/{pipeID}/resize_tty/{height}/{width}").
|
||||
HandlerFunc(requestContextDecorator(resizeTTY(pr)))
|
||||
|
||||
router.Methods("GET").
|
||||
Name("api_pipe_pipeid").
|
||||
Path("/api/pipe/{pipeID}").
|
||||
@@ -53,47 +47,6 @@ func checkPipe(pr PipeRouter) CtxHandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
func resizeTTY(pr PipeRouter) CtxHandlerFunc {
|
||||
return func(ctx context.Context, w http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
height, width uint64
|
||||
err error
|
||||
)
|
||||
id := mux.Vars(r)["pipeID"]
|
||||
height, err = strconv.ParseUint(mux.Vars(r)["height"], 10, 32)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
width, err = strconv.ParseUint(mux.Vars(r)["width"], 10, 32)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
pipe, _, err := pr.Get(ctx, id, ProbeEnd)
|
||||
if err != nil {
|
||||
log.Debugf("Error getting pipe %s: %v", id, err)
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
tty := pipe.GetTTY()
|
||||
if tty == nil {
|
||||
// The pipe doesn't have a tty, nothing to do
|
||||
log.Debugf("Error getting terminal for pipe %s", id)
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
if err = tty.SetSize(uint(height), uint(width)); err != nil {
|
||||
log.Errorf("Error setting terminal size (%d, %d) of pipe %s: %v", height, width, id, err)
|
||||
respondWith(w, http.StatusInternalServerError, err)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func handlePipeWs(pr PipeRouter, end End) CtxHandlerFunc {
|
||||
return func(ctx context.Context, w http.ResponseWriter, r *http.Request) {
|
||||
id := mux.Vars(r)["pipeID"]
|
||||
|
||||
Reference in New Issue
Block a user