fix: recipe lint and logrus usage

This commit is contained in:
decentral1se 2021-09-05 01:21:05 +02:00
parent d5f49594a9
commit 7155a33d31
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

View File

@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path"
"path/filepath"
"sort"
"strconv"
"strings"
@ -18,6 +19,7 @@ import (
"coopcloud.tech/abra/config"
"coopcloud.tech/tagcmp"
loader "coopcloud.tech/abra/client/stack"
"github.com/AlecAivazis/survey/v2"
"github.com/docker/distribution/reference"
"github.com/go-git/go-git/v5"
@ -142,7 +144,7 @@ var recipeCreateCommand = &cli.Command{
}
}
fmt.Printf(
logrus.Infof(
"New recipe '%s' created in %s, happy hacking!\n",
recipe, path.Join(config.APPS_DIR, recipe),
)
@ -361,17 +363,13 @@ var recipeLintCommand = &cli.Command{
internal.ShowSubcommandHelpAndError(c, errors.New("no recipe provided"))
}
appFiles, err := config.LoadAppFiles("")
pattern := fmt.Sprintf("%s/%s/compose**yml", config.APPS_DIR, recipe)
composeFiles, err := filepath.Glob(pattern)
if err != nil {
logrus.Fatal(err)
}
appEnv, err := config.GetApp(appFiles, recipe)
if err != nil {
logrus.Fatal(err)
}
compose, err := config.GetAppComposeConfig(recipe, stack.Deploy{}, appEnv.Env)
opts := stack.Deploy{Composefiles: composeFiles}
compose, err := loader.LoadComposefile(opts, make(map[string]string))
if err != nil {
logrus.Fatal(err)
}