Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Don't clobber other cookbook's attributes #26
comment out default values in attributes/default.rb. Instead of setting default values (which can override the real cookbooks' default values), be more paranoid about checking for existence of those nodes in the template.
Btw, there is another way to handle this:
If you prefer the template code to be simple and clean, without all the 'if' checks, you can create a new recipe in your cookbook which sets the value of these attributes to default values only if the attribute is not already set. Then include that recipe before you run the template.
The advantage of this approach (which is advocated by opscode: http://community.opscode.com/questions/77) is that it can be run either at recipe compilation or recipe convergence time, rather than during attribute compilation. This ensures that all cookbooks have set their up their attributes. Also, if cookbooks set attributes during the recipe convergence phase, this honors the run-list order: your recipe will see any attributes set by recipes executed before this one, which is the intuitive behavior.
ug, even this isn't right. The mysql attributes aren't even really overloading the mysql cookbook's attributes. Or rather, the mysql cookbook does use node['mysql']['server'], but not for the same thing as this cookbook. And I don't think it sets the user or password attributes at all.
datadog really should be using it's own namespace for attributes which are private to this cookbook. It should only be re-using other cookbook's attributes when it's interpreting those attributes the same...