[fix] chaos mode always fails deploy
This commit is contained in:
@ -2,6 +2,7 @@ package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"coopcloud.tech/abra/cli/internal"
|
||||
@ -46,14 +47,12 @@ operations.`,
|
||||
app := internal.ValidateApp(cmd)
|
||||
stackName := app.StackName()
|
||||
|
||||
specificVersion := cmd.Args().Get(1)
|
||||
if specificVersion == "" {
|
||||
specificVersion = app.Recipe.Version
|
||||
ok, err := validateChaosXORVersion(cmd.Args())
|
||||
if !ok {
|
||||
log.Fatalf(err.Error())
|
||||
}
|
||||
|
||||
if specificVersion != "" && internal.Chaos {
|
||||
log.Fatal("cannot use <version> and --chaos together")
|
||||
}
|
||||
specificVersion := getSpecifiedVersion(cmd.Args())
|
||||
|
||||
if specificVersion != "" {
|
||||
log.Debugf("overriding env file version (%s) with %s", app.Recipe.Version, specificVersion)
|
||||
@ -261,3 +260,17 @@ operations.`,
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
// This is not really xor since both can be absent
|
||||
//
|
||||
// but, I say we let it slide this time!
|
||||
func validateChaosXORVersion(args cli.Args) (bool, error) {
|
||||
if getSpecifiedVersion(args) != "" && internal.Chaos {
|
||||
return false, errors.New("cannot use <version> and --chaos together")
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func getSpecifiedVersion(args cli.Args) string {
|
||||
return args.Get(1)
|
||||
}
|
||||
|
Reference in New Issue
Block a user