forked from toolshed/abra
		
	refactor: improved log messages and less quotes
This commit is contained in:
		@ -89,7 +89,7 @@ func (r RecipeMeta) LatestVersion() string {
 | 
			
		||||
		version = tag
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	logrus.Debugf("choosing '%s' as latest version of '%s'", version, r.Name)
 | 
			
		||||
	logrus.Debugf("choosing %s as latest version of %s", version, r.Name)
 | 
			
		||||
 | 
			
		||||
	return version
 | 
			
		||||
}
 | 
			
		||||
@ -152,7 +152,7 @@ func recipeCatalogueFSIsLatest() (bool, error) {
 | 
			
		||||
		return false, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	logrus.Debug("file system cached recipe catalogue is up-to-date")
 | 
			
		||||
	logrus.Debug("file system cached recipe catalogue is now up-to-date")
 | 
			
		||||
 | 
			
		||||
	return true, nil
 | 
			
		||||
}
 | 
			
		||||
@ -193,7 +193,7 @@ func readRecipeCatalogueFS(target interface{}) error {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	logrus.Debugf("read recipe catalogue from file system cache in '%s'", config.APPS_JSON)
 | 
			
		||||
	logrus.Debugf("read recipe catalogue from file system cache in %s", config.APPS_JSON)
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
@ -213,7 +213,7 @@ func readRecipeCatalogueWeb(target interface{}) error {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	logrus.Debugf("read recipe catalogue from web at '%s'", RecipeCatalogueURL)
 | 
			
		||||
	logrus.Debugf("read recipe catalogue from web at %s", RecipeCatalogueURL)
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
@ -241,7 +241,7 @@ func VersionsOfService(recipe, serviceName string) ([]string, error) {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	logrus.Debugf("detected versions '%s' for '%s'", strings.Join(versions, ", "), recipe)
 | 
			
		||||
	logrus.Debugf("detected versions %s for %s", strings.Join(versions, ", "), recipe)
 | 
			
		||||
 | 
			
		||||
	return versions, nil
 | 
			
		||||
}
 | 
			
		||||
@ -255,7 +255,7 @@ func GetRecipeMeta(recipeName string) (RecipeMeta, error) {
 | 
			
		||||
 | 
			
		||||
	recipeMeta, ok := catl[recipeName]
 | 
			
		||||
	if !ok {
 | 
			
		||||
		err := fmt.Errorf("recipe '%s' does not exist?", recipeName)
 | 
			
		||||
		err := fmt.Errorf("recipe %s does not exist?", recipeName)
 | 
			
		||||
		return RecipeMeta{}, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -263,7 +263,7 @@ func GetRecipeMeta(recipeName string) (RecipeMeta, error) {
 | 
			
		||||
		return RecipeMeta{}, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	logrus.Debugf("recipe metadata retrieved for '%s'", recipeName)
 | 
			
		||||
	logrus.Debugf("recipe metadata retrieved for %s", recipeName)
 | 
			
		||||
 | 
			
		||||
	return recipeMeta, nil
 | 
			
		||||
}
 | 
			
		||||
@ -356,7 +356,7 @@ func ReadReposMetadata() (RepoCatalogue, error) {
 | 
			
		||||
 | 
			
		||||
		pagedURL := fmt.Sprintf("%s?page=%v", ReposMetadataURL, pageIdx)
 | 
			
		||||
 | 
			
		||||
		logrus.Debugf("fetching repo metadata from '%s'", pagedURL)
 | 
			
		||||
		logrus.Debugf("fetching repo metadata from %s", pagedURL)
 | 
			
		||||
 | 
			
		||||
		if err := web.ReadJSON(pagedURL, &reposList); err != nil {
 | 
			
		||||
			return reposMeta, err
 | 
			
		||||
@ -392,7 +392,7 @@ func GetStringInBetween(str, start, end string) (result string, err error) {
 | 
			
		||||
	return str[s : s+e], nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func GetImageMetadata(imageRowString string) (image, error) {
 | 
			
		||||
func GetImageMetadata(imageRowString, recipeName string) (image, error) {
 | 
			
		||||
	img := image{}
 | 
			
		||||
 | 
			
		||||
	imgFields := strings.Split(imageRowString, ",")
 | 
			
		||||
@ -402,7 +402,7 @@ func GetImageMetadata(imageRowString string) (image, error) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if len(imgFields) < 3 {
 | 
			
		||||
		logrus.Warnf("image string has incorrect format: %s", imageRowString)
 | 
			
		||||
		logrus.Warnf("%s image meta has incorrect format: %s", recipeName, imageRowString)
 | 
			
		||||
		return img, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -433,7 +433,7 @@ func GetRecipeFeaturesAndCategory(recipeName string) (features, string, error) {
 | 
			
		||||
 | 
			
		||||
	readmePath := path.Join(config.ABRA_DIR, "apps", recipeName, "README.md")
 | 
			
		||||
 | 
			
		||||
	logrus.Debugf("attempting to open '%s'", readmePath)
 | 
			
		||||
	logrus.Debugf("attempting to open %s for recipe metadata parsing", readmePath)
 | 
			
		||||
 | 
			
		||||
	readmeFS, err := ioutil.ReadFile(readmePath)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
@ -488,7 +488,7 @@ func GetRecipeFeaturesAndCategory(recipeName string) (features, string, error) {
 | 
			
		||||
		if strings.Contains(val, "**Image**") {
 | 
			
		||||
			imageMetadata, err := GetImageMetadata(strings.TrimSpace(
 | 
			
		||||
				strings.TrimPrefix(val, "* **Image**:"),
 | 
			
		||||
			))
 | 
			
		||||
			), recipeName)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
@ -505,7 +505,7 @@ func GetRecipeVersions(recipeName string) (RecipeVersions, error) {
 | 
			
		||||
 | 
			
		||||
	recipeDir := path.Join(config.ABRA_DIR, "apps", recipeName)
 | 
			
		||||
 | 
			
		||||
	logrus.Debugf("attempting to open git repository in '%s'", recipeDir)
 | 
			
		||||
	logrus.Debugf("attempting to open git repository in %s", recipeDir)
 | 
			
		||||
 | 
			
		||||
	repo, err := git.PlainOpen(recipeDir)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
@ -525,7 +525,7 @@ func GetRecipeVersions(recipeName string) (RecipeVersions, error) {
 | 
			
		||||
	if err := gitTags.ForEach(func(ref *plumbing.Reference) (err error) {
 | 
			
		||||
		tag := strings.TrimPrefix(string(ref.Name()), "refs/tags/")
 | 
			
		||||
 | 
			
		||||
		logrus.Debugf("processing '%s' for '%s'", tag, recipeName)
 | 
			
		||||
		logrus.Debugf("processing %s for %s", tag, recipeName)
 | 
			
		||||
 | 
			
		||||
		checkOutOpts := &git.CheckoutOptions{
 | 
			
		||||
			Create: false,
 | 
			
		||||
@ -533,11 +533,11 @@ func GetRecipeVersions(recipeName string) (RecipeVersions, error) {
 | 
			
		||||
			Branch: plumbing.ReferenceName(ref.Name()),
 | 
			
		||||
		}
 | 
			
		||||
		if err := worktree.Checkout(checkOutOpts); err != nil {
 | 
			
		||||
			logrus.Debugf("failed to check out '%s' in '%s'", tag, recipeDir)
 | 
			
		||||
			logrus.Debugf("failed to check out %s in %s", tag, recipeDir)
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		logrus.Debugf("successfully checked out '%s' in '%s'", ref.Name(), recipeDir)
 | 
			
		||||
		logrus.Debugf("successfully checked out %s in %s", ref.Name(), recipeDir)
 | 
			
		||||
 | 
			
		||||
		recipe, err := recipe.Get(recipeName)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
@ -571,7 +571,7 @@ func GetRecipeVersions(recipeName string) (RecipeVersions, error) {
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			logrus.Debugf("looking up image: '%s' from '%s'", img, path)
 | 
			
		||||
			logrus.Debugf("looking up image: %s from %s", img, path)
 | 
			
		||||
 | 
			
		||||
			digest, err := client.GetTagDigest(cl, img)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
@ -585,7 +585,7 @@ func GetRecipeVersions(recipeName string) (RecipeVersions, error) {
 | 
			
		||||
				Tag:    img.(reference.NamedTagged).Tag(),
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			logrus.Debugf("collecting digest: '%s', image: '%s', tag: '%s'", digest, path, tag)
 | 
			
		||||
			logrus.Debugf("collecting digest: %s, image: %s, tag: %s", digest, path, tag)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		versions = append(versions, map[string]map[string]ServiceMeta{tag: versionMeta})
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user