Skip to content

Commit

Permalink
Do not fail start command when openssl does not exist
Browse files Browse the repository at this point in the history
Signed-off-by: Zhongcheng Lao <[email protected]>
  • Loading branch information
laozc committed Aug 8, 2019
1 parent aec9406 commit 8b58763
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions pkg/minikube/bootstrapper/certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,15 @@ func configureCACerts(cmd command.Runner, caCerts map[string]string) error {
return stringHash, nil
}

hasSSLBinary := true
if err := cmd.Run("which openssl"); err != nil {
hasSSLBinary = false
}

if !hasSSLBinary && len(caCerts) > 0 {
glog.Warning("OpenSSL not found for certificate subject name hashing. Please recreate the cluster with the latest minikube ISO.")
}

for _, caCertFile := range caCerts {
dstFilename := path.Base(caCertFile)
certStorePath := path.Join(constants.SSLCertStoreDir, dstFilename)
Expand All @@ -303,14 +312,16 @@ func configureCACerts(cmd command.Runner, caCerts map[string]string) error {
return errors.Wrapf(err, "error making symbol link for certificate %s", caCertFile)
}
}
subjectHash, err := getSubjectHash(caCertFile)
if err != nil {
return errors.Wrapf(err, "error calculating subject hash for certificate %s", caCertFile)
}
subjectHashLink := path.Join(constants.SSLCertStoreDir, fmt.Sprintf("%s.0", subjectHash))
if err := cmd.Run(fmt.Sprintf("sudo test -f '%s'", subjectHashLink)); err != nil {
if err := cmd.Run(fmt.Sprintf("sudo ln -s '%s' '%s'", certStorePath, subjectHashLink)); err != nil {
return errors.Wrapf(err, "error making subject hash symbol link for certificate %s", caCertFile)
if hasSSLBinary {
subjectHash, err := getSubjectHash(caCertFile)
if err != nil {
return errors.Wrapf(err, "error calculating subject hash for certificate %s", caCertFile)
}
subjectHashLink := path.Join(constants.SSLCertStoreDir, fmt.Sprintf("%s.0", subjectHash))
if err := cmd.Run(fmt.Sprintf("sudo test -f '%s'", subjectHashLink)); err != nil {
if err := cmd.Run(fmt.Sprintf("sudo ln -s '%s' '%s'", certStorePath, subjectHashLink)); err != nil {
return errors.Wrapf(err, "error making subject hash symbol link for certificate %s", caCertFile)
}
}
}
}
Expand Down

0 comments on commit 8b58763

Please sign in to comment.