fix: --offline/--chaos handlings for backup/check/cmd/restore

This commit is contained in:
2023-09-22 09:47:36 +02:00
parent 9b6eb613aa
commit 79b9cc9be7
12 changed files with 401 additions and 76 deletions

View File

@ -41,6 +41,7 @@ var appBackupCommand = cli.Command{
Flags: []cli.Flag{
internal.DebugFlag,
internal.OfflineFlag,
internal.ChaosFlag,
},
Before: internal.SubCommandBefore,
BashComplete: autocomplete.AppNameComplete,
@ -78,6 +79,22 @@ This single file can be used to restore your app. See "abra app restore" for mor
logrus.Fatal(err)
}
if !internal.Chaos {
if err := recipePkg.EnsureIsClean(app.Recipe); err != nil {
logrus.Fatal(err)
}
if !internal.Offline {
if err := recipePkg.EnsureUpToDate(app.Recipe); err != nil {
logrus.Fatal(err)
}
}
if err := recipePkg.EnsureLatest(app.Recipe); err != nil {
logrus.Fatal(err)
}
}
backupConfigs := make(map[string]backupConfig)
for _, service := range recipe.Config.Services {
if backupsEnabled, ok := service.Deploy.Labels["backupbot.backup"]; ok {