0

次のエージェントをサービスに設定mcollectiveしてインストールしましたservicestart/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 

シェルで実行しようとすると、次のようになります

[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>'

私はRubyの専門家ではないので、修正方法がわかりません。何が起こっているのか手がかりが必要です

4

1 に答える 1