Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.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
Ruby 厨师长默认nginx配方-TypeError无法将符号转换为整数_Ruby_Nginx_Gem_Chef Infra - Fatal编程技术网

Ruby 厨师长默认nginx配方-TypeError无法将符号转换为整数

Ruby 厨师长默认nginx配方-TypeError无法将符号转换为整数,ruby,nginx,gem,chef-infra,Ruby,Nginx,Gem,Chef Infra,我正在学习peepcode厨师教程。我创建了以下nginx default.rb文件- package "nginx" service "nginx" do supports :status => true, :restart => true, :reload => true action[ :enable, :start] end template "/etc/nginx/nginx.conf" do notifies :reload, "serv

我正在学习peepcode厨师教程。我创建了以下nginx default.rb文件-

package "nginx"

service "nginx" do
    supports :status => true, :restart => true, :reload => true
    action[ :enable, :start]
end

template "/etc/nginx/nginx.conf" do
    notifies :reload, "service[nginx]"
end
我运行
chef solo-j/etc/chef/node.json
,得到以下错误-

TypeError
---------
can't convert Symbol into Integer


Cookbook Trace:
---------------
  /cookbooks/nginx/recipes/default.rb:5:in `[]'
  /cookbooks/nginx/recipes/default.rb:5:in `block in from_file'
  /cookbooks/nginx/recipes/default.rb:3:in `from_file'


Relevant File Content:
----------------------
/cookbooks/nginx/recipes/default.rb:

  1:  package "nginx"
  2:
  3:  service "nginx" do
  4:      supports :status => true, :restart => true, :reload => true
  5>>     action[ :enable, :start]
  6:  end
  7:
  8:  template "/etc/nginx/nginx.conf" do
  9:      notifies :reload, "service[nginx]"
 10:  end
 11:
我认为教程使用了chef 10,但我安装了chef 11。是否有一些我遗漏的简单语法错误,或者它已从v10更改为v11

更多信息-

这是我的运行列表文件--

{
    "run_list" : ["recipe[nginx]"]
}
这是我得到的stacktrace-

Generated at 2014-06-22 14:40:20 +0200
TypeError: can't convert Symbol into Integer
/cookbooks/nginx/recipes/default.rb:5:in `[]'
/cookbooks/nginx/recipes/default.rb:5:in `block in from_file'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/dsl/recipe.rb:123:in `instance_eval'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/dsl/recipe.rb:123:in `build_resource'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/dsl/recipe.rb:86:in `declare_resource'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/dsl/recipe.rb:42:in `method_missing'
/cookbooks/nginx/recipes/default.rb:3:in `from_file'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/mixin/from_file.rb:30:in `instance_eval'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/mixin/from_file.rb:30:in `from_file'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/cookbook_version.rb:237:in `load_recipe'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/run_context.rb:165:in `load_recipe'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/run_context/cookbook_compiler.rb:140:in `block in compile_recipes'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/run_context/cookbook_compiler.rb:138:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/run_context/cookbook_compiler.rb:138:in `compile_recipes'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/run_context/cookbook_compiler.rb:75:in `compile'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/run_context.rb:88:in `load'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/policy_builder/expand_node_object.rb:73:in `setup_run_context'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/client.rb:265:in `setup_run_context'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/client.rb:429:in `do_run'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/client.rb:213:in `block in run'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/client.rb:207:in `fork'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/client.rb:207:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/application.rb:217:in `run_chef_client'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/application/solo.rb:221:in `block in run_application'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/application/solo.rb:213:in `loop'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/application/solo.rb:213:in `run_application'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/application.rb:67:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/bin/chef-solo:25:in `<top (required)>'
/usr/local/bin/chef-solo:19:in `load'
于2014-06-22 14:40:20+0200生成
TypeError:无法将符号转换为整数
/cookbooks/nginx/recipes/default.rb:5:in`[]中
/cookbooks/nginx/recipes/default.rb:5:in'block in from_file'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/dsl/recipe.rb:123:in'instance_eval'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/dsl/recipe.rb:123:“构建资源”中
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/dsl/recipe.rb:86:in“declare_resource”
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/dsl/recipe.rb:42:in'method_missing'
/cookbooks/nginx/recipes/default.rb:3:in'from_file'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/mixin/from_file.rb:30:in'instance_eval'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/mixin/from_file.rb:30:in“from_file”
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/cookbook\u version.rb:237:in'load\u recipe'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/run\u context.rb:165:in'load\u recipe'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/run\u context/cookbook\u compiler.rb:140:在“编译食谱中的块”中
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/run\u context/cookbook\u compiler.rb:138:in'each'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/run\u context/cookbook\u compiler.rb:138:in“compile\u recipes”
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/run\u context/cookbook\u compiler.rb:75:in'compile'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/run_context.rb:88:in'load'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/policy\u builder/expand\u node\u object.rb:73:在'setup\u run\u context'中
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/client.rb:265:in'setup\u run\u context'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/client.rb:429:in'do_run'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/client.rb:213:in'block in run'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/client.rb:207:in'fork'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/client.rb:207:in'run'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/application.rb:217:in'run\u chef\u client'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/application/solo.rb:221:在“运行中的块应用程序”中
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/application/solo.rb:213:in'loop'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/application/solo.rb:213:in'run_application'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/application.rb:67:in'run'
/usr/local/lib/ruby/gems/1.9.1/gems/chef-11.12.8/bin/chef-solo:25:in`'
/usr/local/bin/chef solo:19:在“加载”中

我无法访问peepcode教程,但是如果您自己创建了这本nginx cookbook,那么您可能只需要在操作和错误中指定的行中的[:enable,:start]之间留出一个空格。(Nginx默认配方行5) 看