sensu-plugins-mailer 2.0.0 → 2.0.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
- SHA1:
3
- metadata.gz: 511b8ca719d1df99caab5a4c0201ca72f4e165ef
4
- data.tar.gz: 5e3fdaaf730021fc4868bcf08591fd3364ea166d
2
+ SHA256:
3
+ metadata.gz: 8ad181e78c5e2610cd7e1c71df58c691abfd61a79d6a5a0d204be3c9f2678ef3
4
+ data.tar.gz: d553fba10bcb51805773fbc93a0403b4b020cf39850b35265886d13e2bf44c4f
5
5
  SHA512:
6
- metadata.gz: b6fa085f83410b75bbeb79fb3d64783ead7458cfefaf30d04837c3c67ee6579c22a9e7b8aefe86f68397ceabe4e3322061bc4f75ccbe9ffe760eccac1d2822c7
7
- data.tar.gz: 859e4f9c3891d272b4c4d981e893314d42055f7d181e7bac605609385bd327924c977b9c6b0e52ca8648885cd90d823daa2bc76e3b0c1dd5cd40a5aa11bf947b
6
+ metadata.gz: 57cf094ec41772b4299865f4ecc5bcf15b9d5ba9a57820511c559516b92b89a975fe03a8b635651a0b1e738f17d87d1e38e7e821d8e0e2ff30baf4bdad3d0fee
7
+ data.tar.gz: 14a247af62a6d06a6dcfd3e2d9c217246b1315cbe99fdd373903f30e9c1c2105d0760f42b2d7f3c8e5476592f548e7239598376f07a22eb08557d84ce5f1e14e
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [2.0.1] - 2018-01-31
9
+ ### Fixed
10
+ - handler-mailer.rb: emit an `unknown` with a helpful message when receiving an event `@event['contact']` with multiple objects in an array. This helps avoid confusion over using `contact` when you meant `contacts`. (@majormoses)
11
+
8
12
  ## [2.0.0] - 2017-10-21
9
13
  ### Breaking Change
10
14
  - handler-mailer.rb: emit an `unknown` with a helpful message when trying to configure `settings['contact']` with multiple objects. This helps avoid confusion over using `contact` when you meant `contacts`. (@majormoses)
@@ -101,7 +105,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
101
105
  ### Added
102
106
  - initial release
103
107
 
104
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/1.2.0...HEAD
108
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/2.0.1...HEAD
109
+ [2.0.1]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/2.0.0...2.0.1
105
110
  [2.0.0]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/1.2.0...2.0.0
106
111
  [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/1.1.0...1.2.0
107
112
  [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/1.0.0...1.1.0
@@ -135,6 +135,14 @@ class Mailer < Sensu::Handler
135
135
  end
136
136
  end
137
137
 
138
+ def raise_contact_is_array(src)
139
+ msg = "you passed #{src} which is meant to be a string, "
140
+ msg += 'if you need more than one contact you can use `contacts` to '
141
+ msg += 'configure multiple recipients'
142
+ p msg
143
+ exit 3 # unknown
144
+ end
145
+
138
146
  def build_mail_to_list
139
147
  mail_to = Set.new
140
148
  mail_to.add(@event['client']['mail_to'] || json_config_settings['mail_to'])
@@ -146,15 +154,13 @@ class Mailer < Sensu::Handler
146
154
  end
147
155
  end
148
156
  if settings.key?('contact') && settings['contact'].is_a?(Array)
149
- msg = "you passed #{settings['contact']} which is meant to be a string, "
150
- msg += 'if you need more than one contact you can use `contacts` to '
151
- msg += 'configure multiple recipients'
152
- p msg
153
- exit 3 # unknown
157
+ raise_contact_is_array(settings['contact'])
154
158
  elsif settings.key?('contacts')
155
159
  all_contacts = []
156
160
  %w(check client).each do |field|
157
- if @event[field].key?('contact')
161
+ if @event[field].key?('contact') && @event[field]['contact'].is_a?(Array)
162
+ raise_contact_is_array(@event[field]['contact'])
163
+ elsif @event[field].key?('contact')
158
164
  all_contacts << @event[field]['contact']
159
165
  end
160
166
  if @event[field].key?('contacts')
@@ -2,7 +2,7 @@ module SensuPluginsMailer
2
2
  module Version
3
3
  MAJOR = 2
4
4
  MINOR = 0
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-mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.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: 2017-10-21 00:00:00.000000000 Z
11
+ date: 2018-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-ses
@@ -263,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
263
263
  version: '0'
264
264
  requirements: []
265
265
  rubyforge_project:
266
- rubygems_version: 2.6.14
266
+ rubygems_version: 2.7.4
267
267
  signing_key:
268
268
  specification_version: 4
269
269
  summary: Sensu plugins for mailer