mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Remove dead code
This commit is contained in:
parent
72809f8e67
commit
dccfe8046a
@ -88,45 +88,6 @@ func Update(name string, client client.ClientInterface, updatePeriod time.Durati
|
||||
return nil
|
||||
}
|
||||
|
||||
/*// RequestWithBody is a helper method that creates an HTTP request with the specified url, method
|
||||
// and a body read from 'configFile'
|
||||
func requestWithBody(configFile, url, method string) (*http.Request, error) {
|
||||
if len(configFile) == 0 {
|
||||
return nil, fmt.Errorf("empty config file.")
|
||||
}
|
||||
data, err := ioutil.ReadFile(configFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return requestWithBodyData(data, url, method)
|
||||
}
|
||||
|
||||
// RequestWithBodyData is a helper method that creates an HTTP request with the specified url, method
|
||||
// and body data
|
||||
func requestWithBodyData(data []byte, url, method string) (*http.Request, error) {
|
||||
request, err := http.NewRequest(method, url, bytes.NewBuffer(data))
|
||||
request.ContentLength = int64(len(data))
|
||||
return request, err
|
||||
}
|
||||
|
||||
// Execute a request, adds authentication (if auth != nil), and HTTPS cert ignoring.
|
||||
func doRequest(request *http.Request, auth *client.AuthInfo) ([]byte, error) {
|
||||
if auth != nil {
|
||||
request.SetBasicAuth(auth.User, auth.Password)
|
||||
}
|
||||
tr := &http.Transport{
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
}
|
||||
client := &http.Client{Transport: tr}
|
||||
response, err := client.Do(request)
|
||||
if err != nil {
|
||||
return []byte{}, err
|
||||
}
|
||||
defer response.Body.Close()
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
return body, err
|
||||
}*/
|
||||
|
||||
// StopController stops a controller named 'name' by setting replicas to zero
|
||||
func StopController(name string, client client.ClientInterface) error {
|
||||
controller, err := client.GetReplicationController(name)
|
||||
|
@ -258,17 +258,6 @@ func TestCloudCfgDeleteControllerWithReplicas(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func TestRequestWithBodyNoSuchFile(t *testing.T) {
|
||||
request, err := requestWithBody("non/existent/file.json", "http://www.google.com", "GET")
|
||||
if request != nil {
|
||||
t.Error("Unexpected non-nil result")
|
||||
}
|
||||
if err == nil {
|
||||
t.Error("Unexpected non-error")
|
||||
}
|
||||
}*/
|
||||
|
||||
func TestLoadAuthInfo(t *testing.T) {
|
||||
testAuthInfo := &client.AuthInfo{
|
||||
User: "TestUser",
|
||||
|
@ -162,8 +162,6 @@ func (h *HumanReadablePrinter) printStatus(status *api.Status, w io.Writer) erro
|
||||
return err
|
||||
}
|
||||
|
||||
// TODO replace this with something that returns a concrete printer object, rather than
|
||||
// having the secondary switch below.
|
||||
func (h *HumanReadablePrinter) Print(data []byte, output io.Writer) error {
|
||||
var mapObj map[string]interface{}
|
||||
if err := json.Unmarshal([]byte(data), &mapObj); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user