feat: app rm - check if the app is undeployed before removing #61
|
@ -65,6 +65,16 @@ var appRemoveCommand = &cli.Command{
|
|||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
if !internal.Force {
|
||||
// get app status and check if it's deployed
|
||||
statuses, err := config.GetAppStatuses(appFiles)
|
||||
if err != nil {
|
||||
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
if statuses[appName] == "deployed" {
|
||||
return errors.New("app still deployed. Run abra app undeploy first. (or pass --force)")
|
||||
decentral1se
commented
```golang
logrus.Fatal(...)
```
roxxers
commented
Unsure if we want to move to the return flo uses if urfave/cli like actually outputs it to stderr. I used logrus cause its there and we will use it for debug, warn, and info. But for errors we could return to avoid the messy error output. Like the way it looks is fine for a daemon but im reconsidering that for a cli program > ```golang
> logrus.Fatal(...)
> ```
Unsure if we want to move to the return flo uses if urfave/cli like actually outputs it to stderr. I used logrus cause its there and we will use it for debug, warn, and info. But for errors we could return to avoid the messy error output. Like the way it looks is fine for a daemon but im reconsidering that for a cli program
|
||||
}
|
||||
}
|
||||
|
||||
fs := filters.NewArgs()
|
||||
fs.Add("name", appName)
|
||||
|
@ -74,14 +84,14 @@ var appRemoveCommand = &cli.Command{
|
|||
}
|
||||
|
||||
secrets := make(map[string]string)
|
||||
var secretNames []string
|
||||
|
||||
for _, cont := range secretList {
|
||||
secrets[cont.Spec.Annotations.Name] = cont.ID // we have to map the names to ID's
|
||||
secretNames = append(secretNames, cont.Spec.Annotations.Name)
|
||||
}
|
||||
|
||||
if len(secrets) > 0 {
|
||||
var secretNames []string
|
||||
|
||||
for _, cont := range secretList {
|
||||
secrets[cont.Spec.Annotations.Name] = cont.ID // we have to map the names to ID's
|
||||
secretNames = append(secretNames, cont.Spec.Annotations.Name)
|
||||
}
|
||||
|
||||
var secretNamesToRemove []string
|
||||
if !internal.Force {
|
||||
secretsPrompt := &survey.MultiSelect{
|
||||
|
@ -112,11 +122,11 @@ var appRemoveCommand = &cli.Command{
|
|||
}
|
||||
|
||||
var vols []string
|
||||
if len(vols) > 0 {
|
||||
for _, vol := range volumeList {
|
||||
vols = append(vols, vol.Name)
|
||||
}
|
||||
for _, vol := range volumeList {
|
||||
vols = append(vols, vol.Name)
|
||||
}
|
||||
|
||||
if len(vols) > 0 {
|
||||
if Volumes {
|
||||
var removeVols []string
|
||||
if !internal.Force {
|
||||
|
|
Loading…
Reference in New Issue
Is there a reason for doing it like this vs
statuses, err := config.GetAppStatuses(appFiles)
nope, I just brainlessly copied it from cli/app/list.go lol