0
我有配置mcollective
并安装以下service
代理start/stop
服务Mcollective厨师服代理无法运行
https://github.com/rottenbytes/mcollective/blob/master/plugins/agents/chef-service.rb
但是,当我运行它,它未能在client.build_node
和我看到的错误undefined method reset_defaults_and_overrides for nil:NilClass (NoMethodError)
require 'chef'
require 'chef/client'
require 'chef/run_context'
begin
Chef::Config[:solo] = true
Chef::Config[:log_level] = :debug
Chef::Log.level(:debug)
client = Chef::Client.new
client.run_ohai
client.build_node <-- its failing here
如果我尝试在我的外壳上运行,我得到以下内容
[[email protected] agent]# ruby /tmp/foo.rb
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.2/lib/chef/policy_builder/expand_node_object.rb:117:in `build_node': undefined method `reset_defaults_and_overrides' for nil:NilClass (NoMethodError)
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.2/lib/chef/client.rb:259:in `build_node'
from /tmp/foo.rb:11:in `<main>'
我不是红宝石专家,所以我不知道如何解决它。我只需要知道发生了什么
我试过'1.8'和'1.9',但同样的错误,我在哪里得到新的API? – Satish 2015-01-27 00:20:46
这些是Ruby版本,不是Chef版本。基本上在这和你过去的问题之间,你不能使用这个软件。如果没有潜入代码中,它太破碎了,你自己也不愿意这样做。要么聘请顾问,要么找到另一种选择: - /对不起,这个苛刻的答案。 – coderanger 2015-01-27 00:42:12