Skip to content

Commit

Permalink
Create directory using os.MkDirAll, as mkdir -p does not work on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
tstromberg committed Feb 5, 2020
1 parent 6d4ee3a commit 8631246
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/minikube/cluster/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ func commandRunner(h *host.Host) (command.Runner, error) {
return &command.FakeCommandRunner{}, nil
}

if driver.BareMetal(h.Driver.DriverName()) {
if driver.BareMetal(h.Driver.DriverName()) {
glog.Infof("returning ExecRunner for %q driver", d)
return command.NewExecRunner(), nil
return command.NewExecRunner(), nil
}
if driver.IsKIC(d) {
glog.Infof("Returning KICRunner for %q driver", d)
Expand Down
12 changes: 8 additions & 4 deletions pkg/provision/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package provision
import (
"bytes"
"fmt"
"os"
"os/exec"
"path"
"path/filepath"
Expand Down Expand Up @@ -116,16 +117,19 @@ func configureAuth(p miniProvisioner) error {

func copyHostCerts(authOptions auth.Options) error {
log.Infof("copyHostCerts")
execRunner := command.NewExecRunner()

err := os.MkdirAll(authOptions.StorePath, 0700)
if err != nil {
log.Errorf("mkdir failed: %v", err)
}

hostCerts := map[string]string{
authOptions.CaCertPath: path.Join(authOptions.StorePath, "ca.pem"),
authOptions.ClientCertPath: path.Join(authOptions.StorePath, "cert.pem"),
authOptions.ClientKeyPath: path.Join(authOptions.StorePath, "key.pem"),
}

if _, err := execRunner.RunCmd(exec.Command("mkdir", "-p", authOptions.StorePath)); err != nil {
return err
}
execRunner := command.NewExecRunner()
for src, dst := range hostCerts {
f, err := assets.NewFileAsset(src, path.Dir(dst), filepath.Base(dst), "0777")
if err != nil {
Expand Down

0 comments on commit 8631246

Please sign in to comment.