Merge pull request #531 from adamreese/fix/deadcode

fix(manager): remove deadcode
pull/535/head
Adam Reese 9 years ago
commit b93cb08535

@ -19,17 +19,12 @@ package main
import ( import (
"errors" "errors"
"fmt" "fmt"
"io"
"io/ioutil"
"log" "log"
"net" "net"
"net/http" "net/http"
"net/url"
"os" "os"
"strings" "strings"
"github.com/ghodss/yaml"
"github.com/gorilla/mux"
"github.com/kubernetes/helm/cmd/manager/manager" "github.com/kubernetes/helm/cmd/manager/manager"
"github.com/kubernetes/helm/cmd/manager/repository" "github.com/kubernetes/helm/cmd/manager/repository"
"github.com/kubernetes/helm/cmd/manager/repository/persistent" "github.com/kubernetes/helm/cmd/manager/repository/persistent"
@ -41,20 +36,6 @@ import (
"github.com/kubernetes/helm/pkg/util" "github.com/kubernetes/helm/pkg/util"
) )
// Deprecated. Use Context.Manager instead.
var backend manager.Manager
// Route defines a routing table entry to be registered with gorilla/mux.
//
// Route is deprecated. Use router.Routes instead.
type Route struct {
Name string
Path string
Methods string
HandlerFunc http.HandlerFunc
Type string
}
func registerDeploymentRoutes(c *router.Context, h *router.Handler) { func registerDeploymentRoutes(c *router.Context, h *router.Handler) {
h.Add("GET /healthz", healthz) h.Add("GET /healthz", healthz)
h.Add("GET /deployments", listDeploymentsHandlerFunc) h.Add("GET /deployments", listDeploymentsHandlerFunc)
@ -272,25 +253,6 @@ func pos(w http.ResponseWriter, r *http.Request, i int) (string, error) {
return parts[i], nil return parts[i], nil
} }
func getPathVariable(w http.ResponseWriter, r *http.Request, variable, handler string) (string, error) {
vars := mux.Vars(r)
escaped, ok := vars[variable]
if !ok {
e := fmt.Errorf("%s name not found in URL", variable)
util.LogAndReturnError(handler, http.StatusBadRequest, e, w)
return "", e
}
unescaped, err := url.QueryUnescape(escaped)
if err != nil {
e := fmt.Errorf("cannot decode name (%v)", variable)
util.LogAndReturnError(handler, http.StatusBadRequest, e, w)
return "", e
}
return unescaped, nil
}
func getDeploymentRequest(w http.ResponseWriter, r *http.Request, handler string) *common.DeploymentRequest { func getDeploymentRequest(w http.ResponseWriter, r *http.Request, handler string) *common.DeploymentRequest {
util.LogHandlerEntry(handler, r) util.LogHandlerEntry(handler, r)
depReq := &common.DeploymentRequest{} depReq := &common.DeploymentRequest{}
@ -501,28 +463,3 @@ func getCredentialHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.
util.LogHandlerExitWithJSON(handler, w, cr, http.StatusOK) util.LogHandlerExitWithJSON(handler, w, cr, http.StatusOK)
return nil return nil
} }
func getJSONFromRequest(w http.ResponseWriter, r *http.Request, handler string) ([]byte, error) {
util.LogHandlerEntry(handler, r)
b := io.LimitReader(r.Body, *maxLength*1024)
y, err := ioutil.ReadAll(b)
if err != nil {
util.LogAndReturnError(handler, http.StatusBadRequest, err, w)
return []byte{}, err
}
// Reject the input if it exceeded the length limit,
// since we may not have read all of it into the buffer.
if _, err = b.Read(make([]byte, 0, 1)); err != io.EOF {
e := fmt.Errorf("template exceeds maximum length of %d KB", *maxLength)
util.LogAndReturnError(handler, http.StatusBadRequest, e, w)
return []byte{}, err
}
if err := r.Body.Close(); err != nil {
util.LogAndReturnError(handler, http.StatusInternalServerError, err, w)
return []byte{}, err
}
return yaml.YAMLToJSON(y)
}

Loading…
Cancel
Save