refactor(recipe): remove remaining usage of old recipe struct

This commit is contained in:
2024-07-08 13:15:20 +02:00
parent c1b03bcbd7
commit 5617a9ba07
24 changed files with 167 additions and 189 deletions

View File

@ -7,7 +7,6 @@ import (
"coopcloud.tech/abra/pkg/autocomplete"
"coopcloud.tech/abra/pkg/client"
"coopcloud.tech/abra/pkg/log"
"coopcloud.tech/abra/pkg/recipe"
"github.com/urfave/cli"
)
@ -47,8 +46,7 @@ var appBackupListCommand = cli.Command{
Action: func(c *cli.Context) error {
app := internal.ValidateApp(c)
r := recipe.Get2(app.Recipe)
if err := r.Ensure(internal.Chaos, internal.Offline); err != nil {
if err := app.Recipe.Ensure(internal.Chaos, internal.Offline); err != nil {
log.Fatal(err)
}
@ -94,24 +92,23 @@ var appBackupDownloadCommand = cli.Command{
BashComplete: autocomplete.AppNameComplete,
Action: func(c *cli.Context) error {
app := internal.ValidateApp(c)
r := recipe.Get2(app.Recipe)
if err := r.EnsureExists(); err != nil {
if err := app.Recipe.EnsureExists(); err != nil {
log.Fatal(err)
}
if !internal.Chaos {
if err := r.EnsureIsClean(); err != nil {
if err := app.Recipe.EnsureIsClean(); err != nil {
log.Fatal(err)
}
if !internal.Offline {
if err := r.EnsureUpToDate(); err != nil {
if err := app.Recipe.EnsureUpToDate(); err != nil {
log.Fatal(err)
}
}
if err := r.EnsureLatest(); err != nil {
if err := app.Recipe.EnsureLatest(); err != nil {
log.Fatal(err)
}
}
@ -165,24 +162,23 @@ var appBackupCreateCommand = cli.Command{
BashComplete: autocomplete.AppNameComplete,
Action: func(c *cli.Context) error {
app := internal.ValidateApp(c)
r := recipe.Get2(app.Recipe)
if err := r.EnsureExists(); err != nil {
if err := app.Recipe.EnsureExists(); err != nil {
log.Fatal(err)
}
if !internal.Chaos {
if err := r.EnsureIsClean(); err != nil {
if err := app.Recipe.EnsureIsClean(); err != nil {
log.Fatal(err)
}
if !internal.Offline {
if err := r.EnsureUpToDate(); err != nil {
if err := app.Recipe.EnsureUpToDate(); err != nil {
log.Fatal(err)
}
}
if err := r.EnsureLatest(); err != nil {
if err := app.Recipe.EnsureLatest(); err != nil {
log.Fatal(err)
}
}
@ -224,24 +220,23 @@ var appBackupSnapshotsCommand = cli.Command{
BashComplete: autocomplete.AppNameComplete,
Action: func(c *cli.Context) error {
app := internal.ValidateApp(c)
r := recipe.Get2(app.Recipe)
if err := r.EnsureExists(); err != nil {
if err := app.Recipe.EnsureExists(); err != nil {
log.Fatal(err)
}
if !internal.Chaos {
if err := r.EnsureIsClean(); err != nil {
if err := app.Recipe.EnsureIsClean(); err != nil {
log.Fatal(err)
}
if !internal.Offline {
if err := r.EnsureUpToDate(); err != nil {
if err := app.Recipe.EnsureUpToDate(); err != nil {
log.Fatal(err)
}
}
if err := r.EnsureLatest(); err != nil {
if err := app.Recipe.EnsureLatest(); err != nil {
log.Fatal(err)
}
}