Yeah you can do that. You have to use default attrs in your library cookbook and override attrs in all wrapper/role/etc cookbooks, then you roll-your-own include_attributes to run in the recipe code of your wrapper/role cookbook and slurp those in as early as possible. You have to use override attrs or else when you load the library cookbooks attr file you'll overwrite everything again. Generally we think that solution has considerable code smell and isn't going to scale, and is going down the path that has led us to force_override/force_default and other hacks added to Chef to get people out of painting themselves into a corner. The best practice is generally not to be setting attributes in recipe code and to move attribute setting into attribute files in order to get away from compile/converge issues in recipe code. In simple cases, though, that does work. On 1/13/14 6:04 PM, Greg Zapp wrote: " type="cite"> |
Archive powered by MHonArc 2.6.16.