sensu-plugins-jenkins 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39fd5b3937fe6713372b5d63c8e92169d887685b139d45c30a24377fedc67361
4
- data.tar.gz: fa97643c9506f34e80050a32771aee13d57fb85c4c5be1e4474c06a2f07f45b7
3
+ metadata.gz: a1d9455eef0d25ddd14e51eb5209f2744654e1efb0a01fbd401092969d58d1b2
4
+ data.tar.gz: 4c0556da90432d42b4acf3f3ea19d8ea80daf5e27e069d06a9c1f4ce8ad5aedc
5
5
  SHA512:
6
- metadata.gz: d5c34ddffef6b175f89184ad1b98016e2f7952f22a48490f387d78a3608290428aa99da3711e22c1ffdcc4f6ec41aac2bfeb6798c42839405ec31554231477dc
7
- data.tar.gz: cb4e619432b734dc2d4ed385d3dc1d0d5e05d67f4d9d8daaf829244cbd20e35623c42e99b99500d466137a1f9309ffd09604146181cfc926f21a4cda9e768526
6
+ metadata.gz: 081c258532dcf13405f594854c949e7d54e5777f0d5cc6489ca7c0ba48247aaa92ffdedb747e9f0e4c1ebfb1f702d351abc622e74476e362b4dbafa7b5d7b3b5
7
+ data.tar.gz: f80ca63be1d2a744e366f8d762276eb9a7987170dcfc0d6414a21eb0208841985757a305d68828f50d0bfcf6152fea3ca432f77e73bcad1473be9698b8ead1d0
@@ -5,6 +5,14 @@ This CHANGELOG follows the format listed at [Our CHANGELOG Guidelines](https://g
5
5
  Which is based on [Keep A Changelog](http://keepachangelog.com/)
6
6
 
7
7
  ## [Unreleased]
8
+
9
+ ## [1.6.1] - 2018-03-01
10
+ ### Fixed
11
+ - check-jenkins-health.rb: added various rescues to prevent from bricking (@mdzidic) (@majormoses)
12
+
13
+ ### Added
14
+ - check-jenkins-health.rb: added `--verbose` option to allow user to control the output returned when you have an error (@majormoses)
15
+
8
16
  ## [1.6.0] - 2018-02-21
9
17
  ### Added
10
18
  - check-jenkins.rb: Add --insecure parameter to allow self signed ssl certs
@@ -81,7 +89,8 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
81
89
  ### Added
82
90
  - initial release
83
91
 
84
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.6.0...HEAD
92
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.6.1...HEAD
93
+ [1.6.1]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.6.0...1.6.1
85
94
  [1.6.0]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.5.0...1.6.0
86
95
  [1.5.0]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.4.0...1.5.0
87
96
  [1.4.0]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.3.0...1.4.0
@@ -75,19 +75,42 @@ class JenkinsMetricsHealthChecker < Sensu::Plugin::Check::CLI
75
75
  proc: proc(&:to_i),
76
76
  default: 5
77
77
 
78
+ option :verbose,
79
+ short: '-v',
80
+ long: '--verbose',
81
+ boolean: true,
82
+ description: 'Return more verbose errors',
83
+ default: false
84
+
78
85
  def run
79
86
  https ||= config[:https] ? 'https' : 'http'
80
87
  testurl = "#{https}://#{config[:server]}:#{config[:port]}#{config[:uri]}"
81
88
 
82
- r = if config[:https] && config[:insecure]
83
- RestClient::Resource.new(testurl, timeout: config[:timeout], verify_ssl: false).get
84
- elsif config[:https]
85
- RestClient::Resource.new(testurl, timeout: config[:timeout], verify_ssl: true).get
86
- else
87
- RestClient::Resource.new(testurl, timeout: config[:timeout]).get
88
- end
89
-
90
- if [200, 500].include? r.code
89
+ begin
90
+ r = if config[:https] && config[:insecure]
91
+ RestClient::Resource.new(testurl, timeout: config[:timeout], verify_ssl: false)
92
+ elsif config[:https]
93
+ RestClient::Resource.new(testurl, timeout: config[:timeout], verify_ssl: true)
94
+ else
95
+ RestClient::Resource.new(testurl, timeout: config[:timeout])
96
+ end
97
+ if config[:verbose]
98
+ r.get
99
+ else
100
+ r.get { |response| response }
101
+ end
102
+ rescue RestClient::SSLCertificateNotVerified => e
103
+ critical "ssl verification failed: #{e.response}"
104
+ rescue RestClient::ServerBrokeConnection
105
+ critical "server broke the connection: #{e}"
106
+ rescue RestClient::RequestFailed => e
107
+ critical "request failed: #{e.response}"
108
+ rescue RestClient::ExceptionWithResponse => e
109
+ critical "failed to #{e.response}"
110
+ end
111
+ # if you have a 500 it will only reach here if you are not specifying `--verbose`
112
+ # as it will be caught by the rescue above
113
+ if [200, 500].include?(r.code)
91
114
  healthchecks = JSON.parse(r)
92
115
  healthchecks.each do |healthcheck, healthcheck_hash_value|
93
116
  if healthcheck_hash_value['healthy'] != true
@@ -2,7 +2,7 @@ module SensuPluginsJenkins
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 6
5
- PATCH = 0
5
+ PATCH = 1
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-jenkins
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-22 00:00:00.000000000 Z
11
+ date: 2018-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin