Log Errors Missing in Internal

Adds a few missing errors and fix formatting for others.

Fixes #3013
This commit is contained in:
Fernando Diaz 2018-08-30 10:09:04 -05:00
parent edc6e93c19
commit 10de8cac56
5 changed files with 8 additions and 5 deletions

View file

@ -19,6 +19,7 @@ package file
import (
"crypto/sha1"
"encoding/hex"
"github.com/golang/glog"
"io/ioutil"
)
@ -27,6 +28,7 @@ func SHA1(filename string) string {
hasher := sha1.New()
s, err := ioutil.ReadFile(filename)
if err != nil {
glog.Errorf("Error reading file %v", err)
return ""
}

View file

@ -773,7 +773,7 @@ func (n *NGINXController) getServiceClusterEndpoint(svcKey string, backend *exte
}
}
if port == -1 {
return endpoint, fmt.Errorf("Service %q does not have a port named %q", svc.Name, backend.ServicePort)
return endpoint, fmt.Errorf("service %q does not have a port named %q", svc.Name, backend.ServicePort)
}
endpoint.Port = fmt.Sprintf("%d", port)
} else {

View file

@ -395,7 +395,7 @@ func (n NGINXController) DefaultEndpoint() ingress.Endpoint {
// running the command "nginx -t" using a temporal file.
func (n NGINXController) testTemplate(cfg []byte) error {
if len(cfg) == 0 {
return fmt.Errorf("Invalid NGINX configuration (empty)")
return fmt.Errorf("invalid NGINX configuration (empty)")
}
tmpfile, err := ioutil.TempFile("", "nginx-cfg")
if err != nil {
@ -848,7 +848,7 @@ func post(url string, data interface{}) error {
}()
if resp.StatusCode != http.StatusCreated {
return fmt.Errorf("Unexpected error code: %d", resp.StatusCode)
return fmt.Errorf("unexpected error code: %d", resp.StatusCode)
}
return nil

View file

@ -134,7 +134,7 @@ func (s k8sStore) getPemCertificate(secretName string) (*ingress.SSLCert, error)
return nil, ErrSecretForAuth
}
return nil, fmt.Errorf("Secret %q contains no keypair or CA certificate", secretName)
return nil, fmt.Errorf("secret %q contains no keypair or CA certificate", secretName)
}
sslCert.Name = secret.Name
@ -209,7 +209,7 @@ func (s *k8sStore) sendDummyEvent() {
}
// ErrSecretForAuth error to indicate a secret is used for authentication
var ErrSecretForAuth = fmt.Errorf("Secret is used for authentication")
var ErrSecretForAuth = fmt.Errorf("secret is used for authentication")
func isErrSecretForAuth(e error) bool {
return e == ErrSecretForAuth

View file

@ -42,6 +42,7 @@ func ParseNameNS(input string) (string, string, error) {
func GetNodeIPOrName(kubeClient clientset.Interface, name string, useInternalIP bool) string {
node, err := kubeClient.CoreV1().Nodes().Get(name, metav1.GetOptions{})
if err != nil {
glog.Errorf("Error getting node %v: %v", name, err)
return ""
}