fix: app rm quitting when there are no secrets/volumes to remove #56
@ -65,12 +65,6 @@ var appRemoveCommand = &cli.Command{
|
|||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = os.Remove(appPath)
|
|
||||||
if err != nil {
|
|
||||||
logrus.Fatal(err)
|
|
||||||
}
|
|
||||||
logrus.Info(fmt.Sprintf("File: %s removed", appPath))
|
|
||||||
|
|
||||||
fs := filters.NewArgs()
|
fs := filters.NewArgs()
|
||||||
fs.Add("name", appName)
|
fs.Add("name", appName)
|
||||||
secretList, err := cl.SecretList(ctx, types.SecretListOptions{Filters: fs})
|
secretList, err := cl.SecretList(ctx, types.SecretListOptions{Filters: fs})
|
||||||
@ -79,6 +73,7 @@ var appRemoveCommand = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
secrets := make(map[string]string)
|
secrets := make(map[string]string)
|
||||||
|
if len(secrets) > 0 {
|
||||||
var secretNames []string
|
var secretNames []string
|
||||||
|
|
||||||
for _, cont := range secretList {
|
for _, cont := range secretList {
|
||||||
@ -105,9 +100,8 @@ var appRemoveCommand = &cli.Command{
|
|||||||
}
|
}
|
||||||
logrus.Info(fmt.Sprintf("Secret: %s removed", name))
|
logrus.Info(fmt.Sprintf("Secret: %s removed", name))
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
if len(secretNamesToRemove) == 0 {
|
logrus.Info("No secrets to remove")
|
||||||
logrus.Info("No secrets were removed")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
volumeListOKBody, err := cl.VolumeList(ctx, fs)
|
volumeListOKBody, err := cl.VolumeList(ctx, fs)
|
||||||
@ -117,6 +111,7 @@ var appRemoveCommand = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var vols []string
|
var vols []string
|
||||||
|
if len(vols) > 0 {
|
||||||
for _, vol := range volumeList {
|
for _, vol := range volumeList {
|
||||||
vols = append(vols, vol.Name)
|
vols = append(vols, vol.Name)
|
||||||
}
|
}
|
||||||
@ -143,6 +138,15 @@ var appRemoveCommand = &cli.Command{
|
|||||||
} else {
|
} else {
|
||||||
logrus.Info("No volumes were removed")
|
logrus.Info("No volumes were removed")
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
logrus.Info("No volumes to remove")
|
||||||
|
}
|
||||||
|
|
||||||
|
err = os.Remove(appPath)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Fatal(err)
|
||||||
|
}
|
||||||
|
logrus.Info(fmt.Sprintf("File: %s removed", appPath))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user