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:
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"] endThis 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 |
Archive powered by MHonArc 2.6.16.