这本食谱配方有语法错误,但我不明白为什么。我无法上传食谱。
#below reference information we saw in ohai
if node[“platform”] == “ubuntu”
execute “apt-get update” do
command “apt-get update”
end
end
package "apache2" do
action :install
end
# Start the apache service and add to bootup (scripts)
#service directive below
service "apache2" do
action [:start, :enable]
end
> #knife cookbook upload apache Uploading apache
[0.1.1] FATAL: Cookbook file has a ruby syntax error
: FATAL:
> /home/fice/git/chef-repo/cookbooks/apache/recipes/install.rb:8: syntax
> error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
> FATAL: execute “apt-get update” do FATAL:
> ^ FATAL:
> /home/fice/git/chef-repo/cookbooks/apache/recipes/install.rb:9: syntax
> error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
> FATAL:
> /home/fice/git/chef-repo/cookbooks/apache/recipes/install.rb:24:
> syntax error, unexpected keyword_end, expecting end-of-input
答案 0 :(得分:3)
好像你从另一个源复制了一些代码,这些代码可能在你的代码中包含了解析器无法识别的引号。
请使用"
if node[“platform”] == “ubuntu”
execute “apt-get update” do
command “apt-get update”
end
end