DataDog/chef-datadog — pull request #26 by ansel1 (2012-10-24 20:44:49+00:00)
Title: Don't clobber other cookbook's attributes

Fixes #23

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.