Here's my setup
cookbooks /
supervisord /
definitions /
supervisord_group.erb
templates /
process_group.conf.erb
my_app /
recipes /
default.rb
In cookbooks/supervisord/definitions/supervisord_group.erb I have this:
define :supervisord_group, :programs => [], :enable => true do
include_recipe "supervisord::install"
if params[:enable]
template "#{node[:supervisord][:conf_dir]}/#{params[:name]}_group.conf" do
source "process_group.conf.erb"
variables({
:name => params[:name],
:programs => params[:programs].join(",")
})
owner node[:user]
group node[:group]
mode 0755
end
end
end
In cookbooks/my_app/recipes/default.rb I have this:
supervisord_group "myapps" do
programs ["test1", "test2"]
end
The problem is that when I run it I get an error that it's unable to find the template process_group.erb.conf. Here's the output:
Cookbook 'my_app' (0.0.0) does not contain a file at any of these locations:
templates/ubuntu-10.04/process_group.conf.erb
templates/ubuntu/process_group.conf.erb
templates/default/process_group.conf.erb
If my supervisord_group definition is the one referencing the template why is it expecting the my_app cookbook to have it? Any ideas?
So it looks like there is a not-so-clearly-documented property of the template provider that allows you to specify the cookbook that the template lives in. You have to add cookbook "supervisord" to the template setup for it to find it properly.
Thanks to this question
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With