forked from coop-cloud/abra
fix: ensure dirs are created
Also use debug logging for help. Closes coop-cloud/organising#183. Closes coop-cloud/organising#183.
This commit is contained in:
parent
8bfd76fd04
commit
f75e264811
30
cli/cli.go
30
cli/cli.go
|
@ -4,6 +4,7 @@ package cli
|
|||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"coopcloud.tech/abra/cli/app"
|
||||
"coopcloud.tech/abra/cli/catalogue"
|
||||
|
@ -82,17 +83,30 @@ func RunApp(version, commit string) {
|
|||
logrus.SetOutput(os.Stderr)
|
||||
logrus.AddHook(logrusStack.StandardHook())
|
||||
}
|
||||
|
||||
paths := []string{
|
||||
config.ABRA_DIR,
|
||||
path.Join(config.ABRA_DIR, "servers"),
|
||||
path.Join(config.ABRA_DIR, "apps"),
|
||||
path.Join(config.ABRA_DIR, "vendor"),
|
||||
}
|
||||
|
||||
for _, path := range paths {
|
||||
if err := os.Mkdir(path, 0755); err != nil {
|
||||
if !os.IsExist(err) {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
logrus.Debugf("'%s' already created, moving on...", path)
|
||||
continue
|
||||
}
|
||||
logrus.Debugf("'%s' is missing, creating...", path)
|
||||
}
|
||||
|
||||
logrus.Debugf("abra version '%s', commit '%s'", version, commit)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := os.Mkdir(config.ABRA_DIR, 0755); err != nil {
|
||||
if !os.IsExist(err) {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
logrus.Debugf("abra version '%s', commit '%s'", version, commit)
|
||||
|
||||
if err := app.Run(os.Args); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue