api_request method appears to be incompatible with Ruby 1.9
cwjohnston opened this issue · comments
Cameron Johnston commented
Reported via IRC, it appears that Ruby 1.9 expects only a string argument for the URI when creating Net::HTTP objects. Passing a URI::HTTP object as we currently do causes an exception:
{
"timestamp": "2016-09-21T10:07:19.753155-0700",
"level": "info",
"message": "handler output",
"handler": {
"command": "/etc/sensu/mysitehandlers/pagerduty.rb",
"type": "pipe",
"severities": [
"critical"
],
"name": "pagerduty"
},
"output": [
"/usr/lib/ruby/1.9.1/net/http.rb:1860:in `initialize': undefined method `empty?' for #<URI::HTTP:0x0000000251ac78> (NoMethodError)\n",
"\tfrom /usr/lib/ruby/1.9.1/net/http.rb:2093:in `initialize'\n",
"\tfrom /var/lib/gems/1.9.1/gems/sensu-plugin-1.4.2/lib/sensu-handler.rb:136:in `new'\n",
"\tfrom /var/lib/gems/1.9.1/gems/sensu-plugin-1.4.2/lib/sensu-handler.rb:136:in `api_request'\n",
"\tfrom /var/lib/gems/1.9.1/gems/sensu-plugin-1.4.2/lib/sensu-handler.rb:179:in `stash_exists?'\n",
"\tfrom /var/lib/gems/1.9.1/gems/sensu-plugin-1.4.2/lib/sensu-handler.rb:191:in `block (2 levels) in filter_silenced'\n",
"\tfrom /usr/lib/ruby/1.9.1/timmysitet.rb:68:in `timmysitet'\n",
"\tfrom /var/lib/gems/1.9.1/gems/sensu-plugin-1.4.2/lib/sensu-handler.rb:190:in `block in filter_silenced'\n",
"\tfrom /var/lib/gems/1.9.1/gems/sensu-plugin-1.4.2/lib/sensu-handler.rb:188:in `each'\n",
"\tfrom /var/lib/gems/1.9.1/gems/sensu-plugin-1.4.2/lib/sensu-handler.rb:188:in `filter_silenced'\n",
"\tfrom /var/lib/gems/1.9.1/gems/sensu-plugin-1.4.2/lib/sensu-handler.rb:36:in `filter'\n",
"\tfrom /var/lib/gems/1.9.1/gems/sensu-plugin-1.4.2/lib/sensu-handler.rb:80:in `block in <class:Handler>'\n",
"warning: event filtering in sensu-plugin is deprecated, see http://bit.ly/sensu-plugin\n"
]
}