sensu-plugins-sensu 2.4.1 → 2.5.0

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: f7a6f59e123f564d0fa00fd5b58a3c8e3a559e33f229a7e1d67acf7385bbe0fa
4
- data.tar.gz: a1ea1deef5b7202d7f14e2ed1f27184dffba0a45ddf9112dc3b13451cc7f651d
3
+ metadata.gz: 9aa75ea723585cc7af3f900c4e22ee869a96e6200469ab098c40a5d8e7eeafa9
4
+ data.tar.gz: 2dd6b40d04e074df31497dce630d0a74bef06fc848782decefc0a59a73945802
5
5
  SHA512:
6
- metadata.gz: 2e5df05bc2315148cf07e5e561a91d0c910aaf3d764f6208e8d663aa2248b3271678866e5da478a6187d3e8857c250092bb4095f2c022bf283e389ecc5d49f19
7
- data.tar.gz: abcd67c206dc5cb1dd3c7aa544a525378c240f663c55e23b5e089b937d23430facf147d5f5db8c3267a3c875509090e0f13dcb152edc155f6cc2d3a67f74f624
6
+ metadata.gz: bd8a4fd76eb42ca0efbeab04a7bb73af2f9578ce8ac2af490d8ebb8eecae60b64535299389ee261ca77cf66c5532a06a8b0a126d74f92f4debc2413e30104cd3
7
+ data.tar.gz: 5ce1de20012311c1eac79c174f636e769ef1e3b43504ed9fecf2e4e1f83cf5288c4732550615555f1457fc5be201c135383bb6e5d5e62825fe00f0a702cf262b
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.5.0] - 2018-03-06
10
+ ### Changed
11
+ - check-stale-results.rb: support https protocol via api/host declaration
12
+
9
13
  ## [2.4.1] - 2018-01-23
10
14
  ### Fixed
11
15
  - Removed brackets that were added around `subscribers` in the `trigger_remediation` method in #15. This resulted in a successful submission with an HTTP 202, however as this resulted in the subscribers key being an array of arrays which meant that the remediation never was actually scheduled. This fixes it by doing a couple of things, first we remove the extra brackets therefore solving the problem. That being said I decided to add some additional validation of the data to ensure that minimally what is being passed in is an array and the first element is a string, if that is not the case we either error out when unable to determine a fix with a helpful message or in the case of nested arrays attempt to flatten them. (@drhey) (@majormoses)
@@ -113,6 +117,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
113
117
  - initial release
114
118
 
115
119
  [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/2.4.1...HEAD
120
+ [2.5.0]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/2.4.1...2.5.0
116
121
  [2.4.1]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/2.4.0...2.4.1
117
122
  [2.4.0]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/2.3.1...2.4.0
118
123
  [2.3.1]: https://github.com/sensu-plugins/sensu-plugins-sensu/compare/2.3.0...2.3.1
@@ -6,6 +6,7 @@
6
6
  #
7
7
 
8
8
  require 'net/http'
9
+ require 'uri'
9
10
  require 'sensu-plugin/utils'
10
11
  require 'sensu-plugin/check/cli'
11
12
  require 'json'
@@ -60,17 +61,25 @@ class CheckStaleResults < Sensu::Plugin::Check::CLI
60
61
  end.compact.reverse.join(' ')
61
62
  end
62
63
 
64
+ def get_uri(path)
65
+ protocol = (settings['api']['host'] =~ /^https:\/\// ? 'https' : 'http')
66
+ host = (protocol == 'https' ? settings['api']['host'][8..-1] : settings['api']['host'])
67
+ URI("#{protocol}://#{host}:#{settings['api']['port']}#{path}")
68
+ end
69
+
63
70
  def api_request(method, path)
64
71
  unless settings.key?('api')
65
72
  raise 'api.json settings not found.'
66
73
  end
67
- http = Net::HTTP.new(settings['api']['host'], settings['api']['port'])
68
- req = net_http_req_class(method).new(path)
69
- if settings['api']['user'] && settings['api']['password']
70
- req.basic_auth(settings['api']['user'], settings['api']['password'])
74
+ uri = get_uri(path)
75
+ Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
76
+ request = net_http_req_class(method).new(path)
77
+ if settings['api']['user'] && settings['api']['password']
78
+ request.basic_auth(settings['api']['user'], settings['api']['password'])
79
+ end
80
+ yield(request) if block_given?
81
+ http.request request # Net::HTTPResponse object
71
82
  end
72
- yield(req) if block_given?
73
- http.request(req)
74
83
  end
75
84
 
76
85
  def results
@@ -2,8 +2,8 @@ module SensuPluginsSensu
2
2
  # This defines the version of the gem
3
3
  module Version
4
4
  MAJOR = 2
5
- MINOR = 4
6
- PATCH = 1
5
+ MINOR = 5
6
+ PATCH = 0
7
7
 
8
8
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-sensu
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.5.0
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-01-23 00:00:00.000000000 Z
11
+ date: 2018-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -231,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
231
231
  version: '0'
232
232
  requirements: []
233
233
  rubyforge_project:
234
- rubygems_version: 2.7.4
234
+ rubygems_version: 2.7.6
235
235
  signing_key:
236
236
  specification_version: 4
237
237
  summary: Sensu plugins for sensu