Create directory using os.MkDirAll, as mkdir -p does not work on windows

pull/6508/head
tstromberg 2020-02-05 12:37:19 -08:00
parent 6d4ee3ad0b
commit 8631246e76
2 changed files with 10 additions and 6 deletions

View File

@ -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)

View File

@ -19,6 +19,7 @@ package provision
import (
"bytes"
"fmt"
"os"
"os/exec"
"path"
"path/filepath"
@ -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 {