Merge pull request 'fix: app rm quitting when there are no secrets/volumes to remove' (#56) from knoflook/go-abra:dev into main
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Reviewed-on: coop-cloud/go-abra#56
This commit is contained in:
commit
97188b57d9
|
@ -65,12 +65,6 @@ var appRemoveCommand = &cli.Command{
|
|||
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.Add("name", appName)
|
||||
secretList, err := cl.SecretList(ctx, types.SecretListOptions{Filters: fs})
|
||||
|
@ -79,6 +73,7 @@ var appRemoveCommand = &cli.Command{
|
|||
}
|
||||
|
||||
secrets := make(map[string]string)
|
||||
if len(secrets) > 0 {
|
||||
var secretNames []string
|
||||
|
||||
for _, cont := range secretList {
|
||||
|
@ -105,9 +100,8 @@ var appRemoveCommand = &cli.Command{
|
|||
}
|
||||
logrus.Info(fmt.Sprintf("Secret: %s removed", name))
|
||||
}
|
||||
|
||||
if len(secretNamesToRemove) == 0 {
|
||||
logrus.Info("No secrets were removed")
|
||||
} else {
|
||||
logrus.Info("No secrets to remove")
|
||||
}
|
||||
|
||||
volumeListOKBody, err := cl.VolumeList(ctx, fs)
|
||||
|
@ -117,6 +111,7 @@ var appRemoveCommand = &cli.Command{
|
|||
}
|
||||
|
||||
var vols []string
|
||||
if len(vols) > 0 {
|
||||
for _, vol := range volumeList {
|
||||
vols = append(vols, vol.Name)
|
||||
}
|
||||
|
@ -143,6 +138,15 @@ var appRemoveCommand = &cli.Command{
|
|||
} else {
|
||||
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
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue