The Puppet Labs Issue Tracker has Moved:

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using See the following page for information on filing tickets with JIRA:

Bug #16447

agent registration issue with mongodb

Added by chuck scott over 3 years ago. Updated over 2 years ago.

Status:AcceptedStart date:09/17/2012
Priority:NormalDue date:
Assignee:Richard Clamp% Done:


Target version:-
Keywords:mcollective mongodb Affected mCollective version:2.0.0

We've Moved!

Ticket tracking is now hosted in JIRA:

This ticket is now tracked at:


In discussion with R.I.Pienaar

a registration issue with the mcollective/agent/registration.rb plugin

leads to the following stack trace:

[chuck@stubhub-centos62-64-vm6 mcollective]$ tail -20 /var/log/mcollective.log
D, [2012-09-17T10:27:11.904649 #3918] DEBUG -- : stomp.rb:197:in `receive' Waiting for a message from Stomp
D, [2012-09-17T10:27:11.908196 #3918] DEBUG -- : registration.rb:96:in `handlemsg' Updated data for host stubhub-centos62-64-vm6.local with id in 0.00247311592102051s
E, [2012-09-17T10:27:11.908369 #3918] ERROR -- : agents.rb:138:in `dispatch' Execution of registration failed: undefined method `[]' for nil:NilClass
E, [2012-09-17T10:27:11.908454 #3918] ERROR -- : agents.rb:139:in `dispatch' /usr/libexec/mcollective/mcollective/agent/registration.rb:91:in `handlemsg'
/usr/lib/ruby/site_ruby/1.8/mcollective/agents.rb:126:in `dispatch'
/usr/lib/ruby/1.8/timeout.rb:67:in `timeout'
/usr/lib/ruby/site_ruby/1.8/mcollective/agents.rb:125:in `dispatch'
/usr/lib/ruby/site_ruby/1.8/mcollective/agents.rb:121:in `initialize'
/usr/lib/ruby/site_ruby/1.8/mcollective/agents.rb:121:in `new'
/usr/lib/ruby/site_ruby/1.8/mcollective/agents.rb:121:in `dispatch'
/usr/lib/ruby/site_ruby/1.8/mcollective/runner.rb:82:in `agentmsg'
/usr/lib/ruby/site_ruby/1.8/mcollective/runner.rb:55:in `run'
/usr/lib/ruby/site_ruby/1.8/mcollective/runner.rb:50:in `loop'
/usr/lib/ruby/site_ruby/1.8/mcollective/runner.rb:50:in `run'
/usr/lib/ruby/site_ruby/1.8/mcollective/unix_daemon.rb:30:in `daemonize_runner'
/usr/lib/ruby/site_ruby/1.8/mcollective/unix_daemon.rb:13:in `daemonize'
/usr/lib/ruby/site_ruby/1.8/mcollective/unix_daemon.rb:5:in `fork'
/usr/lib/ruby/site_ruby/1.8/mcollective/unix_daemon.rb:5:in `daemonize'
/usr/lib/ruby/site_ruby/1.8/mcollective/unix_daemon.rb:20:in `daemonize_runner'

we resolve the issue by applying the following fix:

[chuck@stubhub-centos62-64-vm6 mcollective]$ diff -u /usr/libexec/mcollective/mcollective/agent/registration.rb /usr/libexec/mcollective/mcollective/agent/registration.rb.orig
--- /usr/libexec/mcollective/mcollective/agent/registration.rb  2012-09-17 11:44:06.362358083 -0700
+++ /usr/libexec/mcollective/mcollective/agent/registration.rb.orig     2012-09-17 11:42:28.734447337 -0700
@@ -82,15 +82,13 @@
by_fqdn = {:fqdn => req[:fqdn]}
doc_id = nil
before =
doc = @coll.find_and_modify(:query => by_fqdn, :update => {'$set' => req}, :new => true)
-          if doc
-             doc_id = doc['_id']
-          else
-            doc_id = @coll.insert(req, {:safe => true})
-          end
+          doc_id = doc['_id']
rescue Mongo::OperationFailure
doc_id = @coll.insert(req, {:safe => true})


#1 Updated by R.I. Pienaar over 3 years ago

  • Project changed from MCollective to MCollective Plugins
  • Category deleted (Plugins)
  • Target version deleted (2.2.x)

#2 Updated by R.I. Pienaar almost 3 years ago

  • Status changed from Unreviewed to Accepted
  • Assignee set to Richard Clamp

Also available in: Atom PDF