Merge pull request #81447 from tariq1890/fix_nil

[kubernetes/kubeadm] fix minor nil issues in kudeadm code
This commit is contained in:
Kubernetes Prow Robot 2019-08-15 04:00:49 -07:00 committed by GitHub
commit 117e83157b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -204,7 +204,7 @@ func getDataFromDisk(cfg *kubeadmapi.InitConfiguration, key []byte) (map[string]
secretData := map[string][]byte{}
for certName, certPath := range certsToTransfer(cfg) {
cert, err := loadAndEncryptCert(certPath, key)
if err == nil || (err != nil && os.IsNotExist(err)) {
if err == nil || os.IsNotExist(err) {
secretData[certOrKeyNameToSecretName(certName)] = cert
} else {
return nil, err

View File

@ -480,8 +480,7 @@ func parseCSRPEM(pemCSR []byte) (*x509.CertificateRequest, error) {
}
if block.Type != certutil.CertificateRequestBlockType {
var block *pem.Block
return nil, errors.Errorf("expected block type %q, but PEM had type %v", certutil.CertificateRequestBlockType, block.Type)
return nil, errors.Errorf("expected block type %q, but PEM had type %q", certutil.CertificateRequestBlockType, block.Type)
}
return x509.ParseCertificateRequest(block.Bytes)