gpt4 book ai didi

ruby - Chef 在错误的文件夹中寻找模板

转载 作者:数据小太阳 更新时间:2023-10-29 08:00:25 24 4
gpt4 key购买 nike

这是我的设置

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 Recipe 有它?有什么想法吗?

最佳答案

所以看起来模板提供者有一个不太清楚记录的属性,它允许您指定模板所在的 Recipe 。您必须添加 cookbook "supervisord"到模板设置,以便正确找到它。

感谢this question

关于ruby - Chef 在错误的文件夹中寻找模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17449587/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com