Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chef Attributes: does file name matter?

When I create attributes in my cookbook's attributes /attributes/default.rb things work fine.

If I add a recipe to my cookbook, say /recipes/dofubar.rb, I expect that attributes defined in /attributes/dofubar.rb to be loaded. They do not appear to be.

Is there a way to define one set of default attributes for one recipe and other sets for other recipes?

like image 679
Code Silverback Avatar asked Aug 26 '14 16:08

Code Silverback


Video Answer


1 Answers

There is no correlation between attribute file names and recipes. All files in the attributes/ folder are loaded in order during the start of the Chef Client run. Even if you name an attribute.rb file the same as a recipe, Chef makes no correlation. All attribute files will be loaded each time.

like image 71
sethvargo Avatar answered Sep 27 '22 19:09

sethvargo