看在错误文件夹的厨师为模板

时间:2013-07-03 13:39:35

标签: ruby chef supervisord

这是我的设置

cookbooks /
    supervisord /
        definitions /
            supervisord_group.erb
        templates /
            process_group.conf.erb
    my_app /
        recipes /
            default.rb

cookbooks/supervisord/definitions/supervisord_group.erb我有这个:

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

在cookbooks / my_app / recipes / default.rb中我有:

supervisord_group "myapps" do
    programs ["test1", "test2"]
end

问题在于,当我运行它时,我收到错误,它无法找到模板process_group.erb.conf。这是输出:

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

如果我的supervisord_group定义是引用模板的定义,为什么期望my_app食谱有它?有什么想法吗?

1 个答案:

答案 0 :(得分:3)

所以看起来模板提供程序有一个不那么明确记录的属性,允许您指定模板所在的菜谱。您必须将cookbook "supervisord"添加到模板设置中找到它。

感谢this question