Skip to content

Commit 4e9e37b

Browse files
authored
Merge pull request #6508 from tstromberg/mkdir-p
Create directory using os.MkDirAll, as mkdir -p does not work on windows
2 parents 88c51d7 + 8631246 commit 4e9e37b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Diff for: pkg/provision/provision.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package provision
1919
import (
2020
"bytes"
2121
"fmt"
22+
"os"
2223
"os/exec"
2324
"path"
2425
"path/filepath"
@@ -116,16 +117,19 @@ func configureAuth(p miniProvisioner) error {
116117

117118
func copyHostCerts(authOptions auth.Options) error {
118119
log.Infof("copyHostCerts")
119-
execRunner := command.NewExecRunner()
120+
121+
err := os.MkdirAll(authOptions.StorePath, 0700)
122+
if err != nil {
123+
log.Errorf("mkdir failed: %v", err)
124+
}
125+
120126
hostCerts := map[string]string{
121127
authOptions.CaCertPath: path.Join(authOptions.StorePath, "ca.pem"),
122128
authOptions.ClientCertPath: path.Join(authOptions.StorePath, "cert.pem"),
123129
authOptions.ClientKeyPath: path.Join(authOptions.StorePath, "key.pem"),
124130
}
125131

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

0 commit comments

Comments
 (0)