Issue #16447 has been updated by Charlie Sharpsteen.

Redmine Issue [#16447](http://projects.puppetlabs.com/issues/16447) has been 
migrated to JIRA:

  <https://tickets.puppetlabs.com/browse/MCO-110>


----------------------------------------
Bug #16447: agent registration issue with mongodb
https://projects.puppetlabs.com/issues/16447#change-101435

* Author: chuck scott
* Status: Accepted
* Priority: Normal
* Assignee: Richard Clamp
* Category: 
* Target version: 
* Keywords: mcollective mongodb
* Branch: 
* Affected mCollective version: 2.0.0
----------------------------------------
In discussion with 
[R.I.Pienaar](https://groups.google.com/a/puppetlabs.com/forum/?fromgroups=#!topic/pe-users/87kqLkiTUMY)

a registration issue with the 
[mcollective/agent/registration.rb](https://raw.github.com/puppetlabs/mcollective-plugins/master/agent/registration-mongodb/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'
    /usr/sbin/mcollectived:43

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 @@
    end
    by_fqdn = {:fqdn => req[:fqdn]}
    doc_id = nil
    before = Time.now.to_f
    begin
    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})
    ensure






-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to