3

这是我的设置

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食谱有它?有任何想法吗?

4

1 回答 1

3

所以看起来模板提供者有一个文档不太清楚的属性,允许您指定模板所在的说明书。您必须添加cookbook "supervisord"到模板设置中才能正确找到它。

感谢这个问题

于 2013-07-03T13:54:37.663 回答