我已经配置mcollective
并安装了以下service
代理来start/stop
服务
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
如果我尝试在我的 shell 上运行,我会得到以下信息
[root@node1 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>'
我不是红宝石专家,所以我不知道如何解决它。我只需要知道发生了什么