[chef-dev] CHEF-3428 user interface


Chronological Thread 
  • From: Avishai Ish-Shalom < >
  • To:
  • Subject: [chef-dev] CHEF-3428 user interface
  • Date: Sat, 22 Dec 2012 00:38:55 +0200
  • Organization: FewBytes Technologies

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


  • [chef-dev] CHEF-3428 user interface, Avishai Ish-Shalom, 12/21/2012

Archive powered by MHonArc 2.6.16.

§