对于我的以下食谱:
template '/etc/filebeat/filebeat.yml' do
source 'filebeat.yml.erb'
owner 'root'
group 'root'
mode '0600'
variables(
stack_name: stack_name,
instance_ip: instance_ip
)
end
我遇到以下错误:
Chef::Mixin::Template::TemplateError
------------------------------------
(erubis):74: syntax error, unexpected '}', expecting keyword_end
Resource Declaration:
---------------------
# In /var/chef/runs/8f9aa33c-6b69-419d-8a02-5668701a228a/local-mode-cache/cache/cookbooks/filebeat/recipes/filebeat.rb
28: template '/etc/filebeat/filebeat.yml' do
29: source 'filebeat.yml.erb'
30: owner 'root'
31: group 'root'
32: mode '0600'
33: variables(
34: stack_name: stack_name,
35: instance_ip: instance_ip
36: )
37: end
38:
Compiled Resource:
------------------
# Declared in /var/chef/runs/44a77122-2816-4f89-97c4-9cbff0bbdfcb/local-mode-cache/cache/cookbooks/-filebeat/recipes/filebeat.rb:28:in `from_file'
template("/etc/filebeat/filebeat.yml") do
action [:create]
retries 0
retry_delay 2
default_guard_interpreter :default
source "filebeat.yml.erb"
variables {:stack_name=>"fsdfsd", :instance_ip=>"172.31.63.242"}
declared_type :template
cookbook_name "filebeat"
recipe_name "filebeat"
owner "root"
group "root"
mode "0600"
path "/etc/filebeat/filebeat.yml"
end
我在做什么错了?
答案 0 :(得分:1)
我认为错误出在您的模板文件中,例如filebeat.yml.erb
我的假设基于(erubis):74: syntax error, unexpected '}', expecting keyword_end
-erubis是厨师使用的快速的eRuby兼容模板引擎(“ erb”)。因此,错误源自解析/渲染模板文件,而不是特定于厨师的问题。