Reputation:
I've noticed that attributes in environments do not get applied if I use node.default
in cookbooks (instead the cookbook attributes get applied). But, the attributes changed in environments get applied if I use node
instead; why? I thought node
and node.default
are one and the same?
Upvotes: 3
Views: 4624
Reputation: 4223
node
gives you a view into the entire node object. node.default
only tells you what values were set at the default
level. As a result, you should NEVER read from node.default
as you would be explicitly ignoring all higher precedent levels. ie, your overrides
would not count. node.default
exists to allow you to SET default values on the node.
Upvotes: 3
Reputation: 78021
Node attribute precedence can be confusing. The document does help, once you read it a couple of times
https://docs.chef.io/attributes.html
My advice is as follows:
The objective here is consistency
Upvotes: 4