Code Silverback
Code Silverback

Reputation: 3224

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?

Upvotes: 12

Views: 6841

Answers (1)

sethvargo
sethvargo

Reputation: 26997

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.

Upvotes: 21

Related Questions