CHEF-3428 user interface


#1
While working on CHEF-3428 my first iteration was to implement the
configurable file search hierarchy in metadata.rb. the current
implementation allows definition of the hierarchy with pseudo
variables like so:
file_hierarchy ["environment-%{environment}", "%{platform}", "default"]
Currently the pseudo variables are environment, platform and
platform_version but it's easy to add support for hierarchy lookup
with node attributes. a common use case may be
["cloud-%{cloud.provider}", ...].


However, specifying the hierarchy in metadata.rb has shortcomings:
  1. the current patch requires changes for both chef and chef_objects (erlang)
  2. the syntax is not pure ruby and not consistent with chef

An alternative which could alleviate these would be specifying the hierarchy in ruby per resource:

template "/path/to/file" do
    source ["environment-#{node.chef_environment}/filename", "#{node["cloud"]["provider"]}/filename", "default/filename"]
end
This syntax feels more comfortable in chef but can be quite a
hassle, i.e. different search path for resources.




I'd love some feedback before moving on with this! 
-- 
Regards,
Avisha