首先尝试使用 chef-solo 来构建一个 vagrant VM。现在由于我的 node.json 文件而遇到错误,其他人之前曾尝试在SO 上解决几次。VM 是 Ubuntu 12.04,工作站和节点都运行 10.16.2。
这是node.json:
{
"name": "apptron",
"description": "slightly complicated config",
"chef_type": "role",
"json_class": "Chef::Role",
"default_attributes": {},
"env_run_lists": {
"_default": [],
"production": [],
"staging": [],
"test": [],
"monitoring": [],
"queuing": []
},
"run_list": ["recipe[base]", "recipe[user]"],
"override_attributes": {}
}
在节点上的堆栈跟踪:
vagrant@web:~$ sudo chef-solo -l debug
[2012-11-03T02:51:08+00:00] INFO: *** Chef 10.16.2 ***
[2012-11-03T02:51:08+00:00] DEBUG: Building node object for web
[2012-11-03T02:51:08+00:00] DEBUG: Extracting run list from JSON attributes provided on command line
[2012-11-03T02:51:08+00:00] DEBUG: Re-raising exception: NoMethodError - undefined method `delete' for role[apptron]:Chef::Role
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/node.rb:407:in `consume_run_list'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/node.rb:392:in `consume_attributes'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/node.rb:380:in `consume_external_attrs'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/client.rb:252:in `build_node'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/client.rb:412:in `do_run'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/client.rb:176:in `run'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/application.rb:140:in `run_chef_client'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/application/solo.rb:224:in `block in run_application'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/application/solo.rb:216:in `loop'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/application/solo.rb:216:in `run_application'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/application.rb:72:in `run'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/bin/chef-solo:25:in `<top (required)>'
/home/vagrant/.rbenv/versions/1.9.3-p194/bin/chef-solo:23:in `load'
/home/vagrant/.rbenv/versions/1.9.3-p194/bin/chef-solo:23:in `<main>'
[2012-11-03T02:51:08+00:00] FATAL: Stacktrace dumped to /var/chef/chef-stacktrace.out
[2012-11-03T02:51:08+00:00] DEBUG: NoMethodError: undefined method `delete' for role[apptron]:Chef::Role
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/node.rb:407:in `consume_run_list'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/node.rb:392:in `consume_attributes'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/node.rb:380:in `consume_external_attrs'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/client.rb:252:in `build_node'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/client.rb:412:in `do_run'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/client.rb:176:in `run'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/application.rb:140:in `run_chef_client'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/application/solo.rb:224:in `block in run_application'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/application/solo.rb:216:in `loop'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/application/solo.rb:216:in `run_application'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/application.rb:72:in `run'
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/bin/chef-solo:25:in `<top (required)>'
/home/vagrant/.rbenv/versions/1.9.3-p194/bin/chef-solo:23:in `load'
/home/vagrant/.rbenv/versions/1.9.3-p194/bin/chef-solo:23:in `<main>'
[2012-11-03T02:51:08+00:00] FATAL: NoMethodError: undefined method `delete' for role[apptron]:Chef::Role