diff --git a/cli/app/logs.go b/cli/app/logs.go index 5c60f3245..b1566f3fa 100644 --- a/cli/app/logs.go +++ b/cli/app/logs.go @@ -11,6 +11,7 @@ import ( "coopcloud.tech/abra/pkg/autocomplete" "coopcloud.tech/abra/pkg/client" "coopcloud.tech/abra/pkg/config" + "coopcloud.tech/abra/pkg/recipe" "coopcloud.tech/abra/pkg/service" "coopcloud.tech/abra/pkg/upstream/stack" "github.com/docker/docker/api/types" @@ -86,6 +87,10 @@ var appLogsCommand = cli.Command{ app := internal.ValidateApp(c) stackName := app.StackName() + if err := recipe.EnsureExists(app.Recipe); err != nil { + logrus.Fatal(err) + } + cl, err := client.New(app.Server) if err != nil { logrus.Fatal(err) diff --git a/tests/integration/app_logs.bats b/tests/integration/app_logs.bats index 4b5e3f508..8760fdcc8 100644 --- a/tests/integration/app_logs.bats +++ b/tests/integration/app_logs.bats @@ -32,3 +32,15 @@ setup(){ assert_failure assert_output --partial 'is not deployed' } + +@test "retrieve recipe if missing" { + run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE" + assert_success + assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE" + + run $ABRA app logs "$TEST_APP_DOMAIN" + assert_failure + assert_output --partial 'is not deployed' + + assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE" +}