0

I have configure mcollective and install following service agent to start/stop service

https://github.com/rottenbytes/mcollective/blob/master/plugins/agents/chef-service.rb

But when i running it, its failing at client.build_node and i am seeing error 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 

If i try to run on my shell i get following

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

I am not ruby expert so i don't know how to fix it. I just need clue what is going on

Satish
  • 16,544
  • 29
  • 93
  • 149

1 Answers1

0

From the looks of it, enough of the internal API for chef client has changed that the mcollective plugin won't work anymore. Try an older version of the chef gem.

coderanger
  • 52,400
  • 4
  • 52
  • 75
  • I tried '1.8' and '1.9' also but same error, where do I get new API? – Satish Jan 27 '15 at 00:20
  • Those are Ruby versions, not Chef versions. Basically between this and your past questions, you cannot use this software. It is too broken to use without diving in to the code and you don't seem willing to do that yourself. Either hire a consultant or find another option :-/ Sorry for the harsh answer. – coderanger Jan 27 '15 at 00:42