Littlechef shouldn't rely on metadata as the definitive list of available recipes #81

merged 2 commits into from Jan 22, 2012


None yet
2 participants

evansd commented Jan 13, 2012

Currently, littlechef only sees recipes that are listed in a cookbook's metadata.json, but according to the OpsCode documentation this list is just used for supplying friendly descriptions for recipes and is not meant to be the definitive list of available recipes.

If you clone the official cookbooks repo you'll see that quite a few of the official cookbooks don't list all their recipes in the metadata. The below commands will print a list of cookbooks together with the number of recipes listed in their metadata and the number they actually contain:

git clone
cd cookbooks
for cookbook in `find * -maxdepth 0 -type d`; \
  do echo -n "$cookbook: "; \
  grep -c ^recipe $cookbook/metadata.rb | tr '\n' ' \0'; \
  ls $cookbook/recipes/*.rb | wc -l; \

David Evans added some commits Jan 12, 2012

David Evans
Test recipes are found even if not in metadata
The list of recipes included in the metadata is to add optional
descriptions to recipes, not to provide the definitive list.

tobami commented Jan 14, 2012

Indeed. I thought "UI aesthetics" referred only to the description of a recipe, not to the declaration itself. But it does appear under the "Optional Fields" section.

I'll have a closer look at your changes because they change quite a bit how recipes are gathered, but for sure it is better to follow Chef guidelines.


tobami commented Jan 22, 2012

OK, your changes look good.

I also did some quick performance tests.
On a kitchen with around 50 cookbooks, fix list_recipes needed 0.010 seconds, in other words, instantaneous compared to python startup time.
With your changes, it took on average 0.013 sec, which is a totally acceptable increase.

Thanks a lot for the patch!

tobami added a commit that referenced this pull request Jan 22, 2012

Merge pull request #81 from drhevans/find_recipes_not_in_metadata
Littlechef shouldn't rely on metadata as the definitive list of available recipes

@tobami tobami merged commit 3465f74 into tobami:master Jan 22, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment