Skip to content

Commit

Permalink
Merge pull request #6508 from tstromberg/mkdir-p
Browse files Browse the repository at this point in the history
Create directory using os.MkDirAll, as mkdir -p does not work on windows
  • Loading branch information
tstromberg authored Feb 5, 2020
2 parents 88c51d7 + 8631246 commit 4e9e37b
Showing 1 changed file with 8 additions and 4 deletions.
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 4e9e37b

Please sign in to comment.