When the expression in if statement returns a nil, the code exits with a status of '2'.  See http://www.skorks.com/2009/09/true-false-and-nil-objects-in-ruby/ for a better explanation as to why false and nil are different.


Jessica

________________________________
 From: nstielau <notifications@github.com>
To: sensu/sensu-community-plugins <sensu-community-plugins@noreply.github.com> 
Cc: Jessica Blackburn <jblackburn22@yahoo.com> 
Sent: Thursday, March 21, 2013 11:37 AM
Subject: Re: [sensu-community-plugins] Wrap data elements to prevent abnormal exit (#163)
 

In plugins/rabbitmq/rabbitmq-overview-metrics.rb:
> @@ -99,20 +99,22 @@ def run
>      output "#{config[:scheme]}.queue_totals.messages_ready.rate", overview['queue_totals']['messages_ready_details']['rate'], timestamp
>  
>      # overview['message_stats']['publish']
> -    if overview['message_stats']['publish'] then 
> +    if overview['message_stats'].include?('publish') then 
Shouldn't overview['message_stats']['publish'] be functionally equivalent to overview['message_stats'].include?('publish') as the former will return nil and the latter false, which both evaluate to false?   Is this a style thing?
—
Reply to this email directly or view it on GitHub.