-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't clobber other cookbook's attributes #26
Conversation
Fixes DataDog#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.
It's a super node used by mysql for something else completely. We really need our own setting here.
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... |
postgres is the same way. I'm with the other guy. These should be namespaced to datadog. They are unique semantically. |
+1 for moving all of them into the datadog namespace. I'm using the Redisio (not Redis) cookbook, so I have to use a wrapper that transforms it's values into Redis values. Might as well just be explicit and use DataDog values. |
+1 here for the namespace. Having a conflict with redis cookbook at the moment. |
We hear you. attributes are going to be namespaced. |
+1. Had problems with Redis cookbook and spent significant time trying to figure out why. Would appreciate a fix. |
This is going to be merged into #43. |
+1 for moving all node attributes under the datadog namespace. That's a general expectation for well-behaving chef cookbooks, in my opinion. |
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.