forked from toolshed/abra
refactor: use central logger
This commit is contained in:
@ -8,21 +8,21 @@ import (
|
||||
|
||||
"coopcloud.tech/abra/pkg/config"
|
||||
gitPkg "coopcloud.tech/abra/pkg/git"
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
"github.com/go-git/go-git/v5"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// EnsureCatalogue ensures that the catalogue is cloned locally & present.
|
||||
func EnsureCatalogue() error {
|
||||
catalogueDir := path.Join(config.ABRA_DIR, "catalogue")
|
||||
if _, err := os.Stat(catalogueDir); err != nil && os.IsNotExist(err) {
|
||||
logrus.Warnf("local recipe catalogue is missing, retrieving now")
|
||||
log.Warnf("local recipe catalogue is missing, retrieving now")
|
||||
url := fmt.Sprintf("%s/%s.git", config.REPOS_BASE_URL, config.CATALOGUE_JSON_REPO_NAME)
|
||||
if err := gitPkg.Clone(catalogueDir, url); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logrus.Debugf("cloned catalogue repository to %s", catalogueDir)
|
||||
log.Debugf("cloned catalogue repository to %s", catalogueDir)
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -57,7 +57,7 @@ func EnsureUpToDate() error {
|
||||
|
||||
if len(remotes) == 0 {
|
||||
msg := "cannot ensure %s is up-to-date, no git remotes configured"
|
||||
logrus.Debugf(msg, config.CATALOGUE_DIR)
|
||||
log.Debugf(msg, config.CATALOGUE_DIR)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ func EnsureUpToDate() error {
|
||||
}
|
||||
}
|
||||
|
||||
logrus.Debugf("fetched latest git changes for %s", config.CATALOGUE_DIR)
|
||||
log.Debugf("fetched latest git changes for %s", config.CATALOGUE_DIR)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user