opscode/chef — pull request #453 by danielsdeleo (2012-10-25 21:41:16+00:00)
Title: [CHEF-2963;OC-4355] Make role and environment attributes available in attributes files

This change makes environment and role attributes explicit components of the attributes collection. They are merged according to the order described in the documentation. Attributes from environments and roles are set on the Node::Attribute object when the run_list is expanded, so they are available for read during attribute file evaluation.

There are two gotchas with this change:
1. There is now no difference in attribute precedence between attributes files and recipes. I've discussed this with a few people and they felt this was an improvement.
2. The JSON representation of a node is now slightly lossy, because the default and override attribute objects are computed from their components. In practice this should not be a big issue, because default, override, and automatic attributes are cleared and rebuilt for each chef run; they are only sent to the server for indexing and informational purposes. I still feel this issue should be fixed, but that requires changes to erchef and the related pedant tests. We should be able to change the serialization format in a backwards compatible way, so there is no need to make the server-side changes for Chef 11.0.