Merge pull request #46977 from php-coder/improve_cert_controller_logging

Automatic merge from submit-queue

newCFSSLSigner: improve error reporting by including file name in the message

**What this PR does / why we need it**:

This PR improves error reporting by including an action and a file name into the error message.

Before:
>E0605 17:01:57.020485   29156 certificates.go:38] Failed to start certificate controller: open : no such file or directory

After:
>E0605 18:21:32.375884    4896 certificates.go:38] Failed to start certificate controller: error reading CA file "": open : no such file or directory

**Release note**:
```release-note
NONE
```

CC @mfojtik
This commit is contained in:
Kubernetes Submit Queue 2017-06-07 07:29:18 -07:00 committed by GitHub
commit d062629543

View File

@ -64,16 +64,16 @@ type cfsslSigner struct {
func newCFSSLSigner(caFile, caKeyFile string, client clientset.Interface, certificateDuration time.Duration) (*cfsslSigner, error) {
ca, err := ioutil.ReadFile(caFile)
if err != nil {
return nil, err
return nil, fmt.Errorf("error reading CA cert file %q: %v", caFile, err)
}
cakey, err := ioutil.ReadFile(caKeyFile)
if err != nil {
return nil, err
return nil, fmt.Errorf("error reading CA key file %q: %v", caKeyFile, err)
}
parsedCa, err := helpers.ParseCertificatePEM(ca)
if err != nil {
return nil, err
return nil, fmt.Errorf("error parsing CA cert file %q: %v", caFile, err)
}
strPassword := os.Getenv("CFSSL_CA_PK_PASSWORD")