Skip to content

Commit

Permalink
improving error message in check-stale-results when api config is n…
Browse files Browse the repository at this point in the history
…ot present

Signed-off-by: Ben Abrams <me@benabrams.it>
  • Loading branch information
majormoses committed Jun 30, 2018
1 parent 0bf8ab2 commit cddf5bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)

## [Unreleased]

### Changed
- check-stale-results.rb: improve error message when there is no api key in sensu settings (@majormoses)

## [3.0.0] - 2018-05-17
### Breaking Change
- bumped dependency of `sensu-plugin` to 2.x you can read about it [here](https://github.com/sensu-plugins/sensu-plugin/blob/master/CHANGELOG.md#v200---2017-03-29)

Expand Down
6 changes: 5 additions & 1 deletion bin/check-stale-results.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ def get_uri(path)

def api_request(method, path)
unless settings.key?('api')
raise 'api.json settings not found.'
raise <<EOF
sensu does not have an api config stanza set, please configure it in
either /etc/sensu/config.json or in any config that is loaded by sensu
such as /etc/sensu/conf.d/api.json
EOF
end
uri = get_uri(path)
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
Expand Down

0 comments on commit cddf5bb

Please sign in to comment.