Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Templates 流浪汉-厨师-模板文件检查_Templates_Chef Infra_Vagrant - Fatal编程技术网

Templates 流浪汉-厨师-模板文件检查

Templates 流浪汉-厨师-模板文件检查,templates,chef-infra,vagrant,Templates,Chef Infra,Vagrant,如何将其导出以测试是否存在模板文件 我只想在没有其他适当配置的情况下加载webserver default.conf.erb 我也这么想,但没有成功 template "#{node[:nginx][:dir]}/sites-available/#{host_name}.loc.conf" do variables attribs if File.exists? ("/templates/default/#{host_name}.conf.erb")

如何将其导出以测试是否存在模板文件

我只想在没有其他适当配置的情况下加载webserver default.conf.erb

我也这么想,但没有成功

template "#{node[:nginx][:dir]}/sites-available/#{host_name}.loc.conf" do
        variables attribs

        if File.exists? ("/templates/default/#{host_name}.conf.erb")
            source "#{host_name}.conf.erb"
        else
            source "default.conf.erb"
        end

        notifies :reload, "service[nginx]"
end
这样一个概念(在的标签下)已经在chef中实现

只需将文件放在
templates/host-{host\u name}/
中,而不是
templates/default/