Skip to content

Commit

Permalink
Merge pull request #8 from influxdata/5-create-wirey-folder
Browse files Browse the repository at this point in the history
Create wirey folder if not exists - fixes #5
  • Loading branch information
fntlnz committed Apr 27, 2018
2 parents 46914af + a67e12f commit 4050877
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/wirey/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"log"
"os"
"path/filepath"
"strings"

"github.com/influxdata/wirey/backend"
Expand Down Expand Up @@ -32,6 +33,13 @@ var rootCmd = &cobra.Command{
log.Fatal(err)
}

privKeyBaseDir := filepath.Dir(privateKeyPath)
if _, err := os.Stat(privKeyBaseDir); os.IsNotExist(err) {
if err := os.Mkdir(privKeyBaseDir, 0600); err != nil {
log.Fatal("Unable to create the base directory for the wirey private key: %s - %s", privKeyBaseDir, err.Error())
}
}

i, err := backend.NewInterface(b, ifname, fmt.Sprintf("%s:%s", endpoint, endpointPort), ipAddr, privateKeyPath)

if err != nil {
Expand Down

0 comments on commit 4050877

Please sign in to comment.