首先尝试使用chef-solo旋转一个流浪汉VM。现在由于我的node.json文件遇到错误,其他人尝试address on SO几个times before。 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
答案 0 :(得分:1)
由于某种原因,当我应用此问题时,问题出现在node.json
键json_class: "Chef::Role"
,我得到了奇怪的错误。当我不这样做时,一切都按照Vagrant的预期运行。
答案 1 :(得分:1)
您将角色json数据放入节点json文件中,这就是导致此问题的原因。
这一位:
"chef_type": "role",
"json_class": "Chef::Role",
属于角色json。
在我的情况下,我在角色json中有节点json数据,在节点json中有角色json数据... herp derp:)