cmd/uplinkng: mkdir config file folder
If the directory doesn't exist, then the first run in a non-migration setting will error because it cannot create the config file. This change creates the directory. Change-Id: I439159c00047e9ae20e139318dad5a047c853253
This commit is contained in:
parent
8c1a149de2
commit
f94d8a200c
@ -5,6 +5,7 @@ package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@ -72,7 +73,14 @@ func (ex *external) SaveConfig(values map[string]string) error {
|
||||
func (ex *external) saveConfig(entries []ini.Entry) error {
|
||||
// TODO(jeff): write it atomically
|
||||
|
||||
newFh, err := os.Create(ex.ConfigFile())
|
||||
path := ex.ConfigFile()
|
||||
dir := filepath.Dir(path)
|
||||
|
||||
if err := os.MkdirAll(dir, 0755); err != nil {
|
||||
return errs.Wrap(err)
|
||||
}
|
||||
|
||||
newFh, err := os.Create(path)
|
||||
if err != nil {
|
||||
return errs.Wrap(err)
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ func commands(cmds clingy.Commands, ex ulext.External) {
|
||||
cmds.New("share", "Shares restricted accesses to objects", newCmdShare(ex))
|
||||
cmds.New("mb", "Create a new bucket", newCmdMb(ex))
|
||||
cmds.New("rb", "Remove a bucket bucket", newCmdRb(ex))
|
||||
cmds.New("cp", "Copies files or objects into or out of tardigrade", newCmdCp(ex))
|
||||
cmds.New("cp", "Copies files or objects into or out of storj", newCmdCp(ex))
|
||||
cmds.New("ls", "Lists buckets, prefixes, or objects", newCmdLs(ex))
|
||||
cmds.New("rm", "Remove an object", newCmdRm(ex))
|
||||
cmds.Group("meta", "Object metadata related commands", func() {
|
||||
|
Loading…
Reference in New Issue
Block a user