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
1 changed files with 7 additions and 9 deletions

View File

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