Chef infra Chef solo run_列表错误与JSON

Chef infra Chef solo run_列表错误与JSON,chef-infra,vagrant,Chef Infra,Vagrant,首先尝试与厨师索洛一起打造一个流浪VM。现在由于我的node.json文件而遇到一个错误,其他人尝试了几次。虚拟机是Ubuntu 12.04,工作站和节点都运行10.16.2 以下是node.json: { "name": "apptron", "description": "slightly complicated config", "chef_type": "role", "json_class": "Chef::Role", "default_attributes":

首先尝试与厨师索洛一起打造一个流浪VM。现在由于我的node.json文件而遇到一个错误,其他人尝试了几次。虚拟机是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": {}
}
在stacktrace节点上:

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
vagrant@web:~$sudo chef solo-l调试
[2012-11-03T02:51:08+00:00]信息:**Chef 10.16.2***
[2012-11-03T02:51:08+00:00]调试:为web构建节点对象
[2012-11-03T02:51:08+00:00]调试:从命令行提供的JSON属性中提取运行列表
[2012-11-03T02:51:08+00:00]调试:重新引发异常:NoMethodError-角色[apptron]的未定义方法“delete]: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:在“消费运行列表”中
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/node.rb:392:在“消费属性”中
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/node.rb:380:在“消费外部属性”中
/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\u chef\u 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:在“运行中的块应用程序”中
/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:在“运行应用程序”中
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/application.rb:72:运行中
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/bin/chef-solo:25:in`'
/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`'
[2012-11-03T02:51:08+00:00]致命:Stacktrace转储到/var/chef/chef-Stacktrace.out
[2012-11-03T02:51:08+00:00]调试:命名错误:角色[apptron]的未定义方法“delete]: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:在“消费运行列表”中
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/node.rb:392:在“消费属性”中
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/node.rb:380:在“消费外部属性”中
/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\u chef\u 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:在“运行中的块应用程序”中
/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:在“运行应用程序”中
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/application.rb:72:运行中
/home/vagrant/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.16.2/bin/chef-solo:25:in`'
/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`'
[2012-11-03T02:51:08+00:00]致命:命名错误:角色[apptron]的未定义方法“delete]:Chef::role

原来问题出在
节点上。json
json\u类:“Chef::Role”
由于某种原因,当我应用这个时,我得到了一个奇怪的错误。当我不这样做的时候,一切都在流浪汉身上如期运行

您正在将角色json数据放入节点json文件,这就是导致此问题的原因

此位:

"chef_type": "role",
"json_class": "Chef::Role",
属于json角色


在我的例子中,我在角色json中有节点json数据,在节点json中有角色json数据。。。herp derp:)

你找到这个问题的解决方案了吗?回答你自己的问题没关系。请不要忘记将答案标记为正确!:)