puppetlabs/mcollective-puppet-agent — pull request #21 by richardc (2014-04-24 16:12:58+00:00)
Title: maint - check if there are results to sparkline first

Array#min and Array#max on an empty array return nil. Here we check
if the array if empty first.

Avoids this segfault.

mco puppet summary -v
Discovering hosts using the mc method for 2 second(s) .... 0

No request sent, we did not discover any nodes.Summary statistics for 0 nodes:

The puppet application failed to run: undefined method `-' for nil:NilClass

undefined method `-' for nil:NilClass (NoMethodError)
from /usr/libexec/mcollective/mcollective/application/puppet.rb:184:in `sparkline_for_field' <----
from /usr/libexec/mcollective/mcollective/application/puppet.rb:281:in `summary_command'
from /usr/libexec/mcollective/mcollective/application/puppet.rb:357:in `send'
from /usr/libexec/mcollective/mcollective/application/puppet.rb:357:in `main'
from /usr/lib/ruby/site_ruby/1.8/mcollective/application.rb:291:in `run'
from /usr/lib/ruby/site_ruby/1.8/mcollective/applications.rb:23:in `run'
from /usr/bin/mco:20