fix captplanet and satellite overwrite flags (#516)

* fix captplanet and satellite overwrite flags
This commit is contained in:
Maximillian von Briesen 2018-10-19 11:06:02 -04:00 committed by GitHub
parent a61de403d7
commit 94128d63a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -58,6 +58,12 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) {
if !setupCfg.Overwrite && err == nil {
fmt.Println("A captplanet configuration already exists. Rerun with --overwrite")
return nil
} else if setupCfg.Overwrite && err == nil {
fmt.Println("overwriting existing captplanet config")
err = os.RemoveAll(setupCfg.BasePath)
if err != nil {
return err
}
}
hcPath := filepath.Join(setupCfg.BasePath, "satellite")

View File

@ -92,6 +92,12 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) {
if !setupCfg.Overwrite && err == nil {
fmt.Println("An satellite configuration already exists. Rerun with --overwrite")
return nil
} else if setupCfg.Overwrite && err == nil {
fmt.Println("overwriting existing satellite config")
err = os.RemoveAll(setupCfg.BasePath)
if err != nil {
return err
}
}
err = os.MkdirAll(setupCfg.BasePath, 0700)