sensu-plugins-mailer 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1c3d712e7a473e4dc7571e465f067e4497484b42
4
- data.tar.gz: f47d34aa664b4c8c9e65e081d3b00f5e613a01c4
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YjJkYjU5MTAzODM1ZDc5M2UxNGMyZDU4MTgxMDBkYTA4N2UwMzU0Yw==
5
+ data.tar.gz: !binary |-
6
+ OTc1ODdlMzA1YWQ4ODE4YTAzMGUxMGU3NWQ3M2M0ZTViOGM1ZDk3Yg==
5
7
  SHA512:
6
- metadata.gz: 073a92eb9c05aa317b8ad32ecac10920fd2d465fdf26d6bc1976c1a10c743e251535b63698a7a7aa44fd4b0ae2b61dfeafc29813ac2c92a29233271c87502550
7
- data.tar.gz: 6406eeaf78409ec3957ea6f66a028b7e03770321754df94123a4e49f965b7fedd18c2764538d5f49d77935d7927045f45ab0d873a34533c2aa21bbed23248ba3
8
+ metadata.gz: !binary |-
9
+ YWY0OTA2OGJkNzhiZDgxM2E4ODJjMmI4NzY2OGNjNDcxZDViMDk2MjU5NWIz
10
+ M2U3ZGE2MDNkOTNmZDk1ZmFiYWJkN2RkODY1ODA5MDYyYzAwMGZlMmExYjUz
11
+ MThlNjQxMzQyYmFiOTRmM2YwMjkzODBjM2MxODQ3YWVjNTJjN2Q=
12
+ data.tar.gz: !binary |-
13
+ YzM4YTE2NDgyZTE1ZGE4MzcxZjVlNjUyYTRlNWYxZTU0OWMzZGNlMGQ5ODIy
14
+ YTBiMzVlOTlmMmRhMzViNjNjNDM3OTQzOTY2YTQ5NGIzNTQ5MDY3MmYxZDdl
15
+ NWJkYWYxOTliOWUyYWM0OWY5MDI1ZWUwMzlmZDlmNmY3NDI2OGU=
@@ -74,17 +74,17 @@ class Mailer < Sensu::Handler
74
74
  end
75
75
 
76
76
  def parse_content_type
77
- if config[:content_type]
78
- use = config[:content_type]
79
- elsif @event['check']['content_type']
80
- use = @event['check']['content_type']
81
- elsif settings[config[:json_config]]['content_type']
82
- use = settings[config[:json_config]]['content_type']
83
- else
84
- use = 'plain'
85
- end
86
-
87
- if use.downcase == 'html'
77
+ use = if config[:content_type]
78
+ config[:content_type]
79
+ elsif @event['check']['content_type']
80
+ @event['check']['content_type']
81
+ elsif settings[config[:json_config]]['content_type']
82
+ settings[config[:json_config]]['content_type']
83
+ else
84
+ 'plain'
85
+ end
86
+
87
+ if use.casecmp('html')
88
88
  'text/html; charset=UTF-8'
89
89
  else
90
90
  'text/plain; charset=ISO-8859-1'
@@ -115,14 +115,14 @@ class Mailer < Sensu::Handler
115
115
  json_config = config[:json_config]
116
116
  admin_gui = settings[json_config]['admin_gui'] || 'http://localhost:8080/'
117
117
  # try to redact passwords from output and command
118
- output = "#{@event['check']['output']}".gsub(/(\s-p|\s-P|\s--password)(\s*\S+)/, '\1 <password omitted>')
119
- command = "#{@event['check']['command']}".gsub(/(\s-p|\s-P|\s--password)(\s*\S+)/, '\1 <password omitted>')
118
+ output = (@event['check']['output']).to_s.gsub(/(\s-p|\s-P|\s--password)(\s*\S+)/, '\1 <password omitted>')
119
+ command = (@event['check']['command']).to_s.gsub(/(\s-p|\s-P|\s--password)(\s*\S+)/, '\1 <password omitted>')
120
120
  playbook = "Playbook: #{@event['check']['playbook']}" if @event['check']['playbook']
121
121
 
122
- if message_template && File.readable?(message_template)
123
- template = File.read(message_template)
124
- else
125
- template = <<-BODY.gsub(/^\s+/, '')
122
+ template = if message_template && File.readable?(message_template)
123
+ File.read(message_template)
124
+ else
125
+ <<-BODY.gsub(/^\s+/, '')
126
126
  <%= output %>
127
127
  Admin GUI: <%= admin_gui %>
128
128
  Host: <%= @event['client']['name'] %>
@@ -134,7 +134,7 @@ class Mailer < Sensu::Handler
134
134
  Occurrences: <%= @event['occurrences'] %>
135
135
  <%= playbook %>
136
136
  BODY
137
- end
137
+ end
138
138
  eruby = Erubis::Eruby.new(template)
139
139
  eruby.result(binding)
140
140
  end
@@ -144,7 +144,7 @@ class Mailer < Sensu::Handler
144
144
  body = build_body
145
145
  content_type = parse_content_type
146
146
  mail_to = build_mail_to_list
147
- mail_from = settings[json_config]['mail_from']
147
+ mail_from = settings[json_config]['mail_from']
148
148
  reply_to = settings[json_config]['reply_to'] || mail_from
149
149
 
150
150
  delivery_method = settings[json_config]['delivery_method'] || 'smtp'
@@ -160,19 +160,19 @@ class Mailer < Sensu::Handler
160
160
  timeout_interval = settings[json_config]['timeout'] || 10
161
161
 
162
162
  headers = {
163
- 'X-Sensu-Host' => "#{@event['client']['name']}",
164
- 'X-Sensu-Timestamp' => "#{Time.at(@event['check']['issued'])}",
165
- 'X-Sensu-Address' => "#{@event['client']['address']}",
166
- 'X-Sensu-Check-Name' => "#{@event['check']['name']}",
167
- 'X-Sensu-Status' => "#{status_to_string}",
168
- 'X-Sensu-Occurrences' => "#{@event['occurrences']}"
163
+ 'X-Sensu-Host' => (@event['client']['name']).to_s,
164
+ 'X-Sensu-Timestamp' => Time.at(@event['check']['issued']).to_s,
165
+ 'X-Sensu-Address' => (@event['client']['address']).to_s,
166
+ 'X-Sensu-Check-Name' => (@event['check']['name']).to_s,
167
+ 'X-Sensu-Status' => status_to_string.to_s,
168
+ 'X-Sensu-Occurrences' => (@event['occurrences']).to_s
169
169
  }
170
170
 
171
- if @event['check']['notification'].nil?
172
- subject = "#{action_to_string} - #{short_name}: #{status_to_string}"
173
- else
174
- subject = "#{action_to_string} - #{short_name}: #{@event['check']['notification']}"
175
- end
171
+ subject = if @event['check']['notification'].nil?
172
+ "#{action_to_string} - #{short_name}: #{status_to_string}"
173
+ else
174
+ "#{action_to_string} - #{short_name}: #{@event['check']['notification']}"
175
+ end
176
176
 
177
177
  Mail.defaults do
178
178
  delivery_options = {
@@ -2,7 +2,7 @@ module SensuPluginsMailer
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 2
5
+ PATCH = 3
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,36 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDgDCCAmigAwIBAgIBATANBgkqhkiG9w0BAQUFADBDMRIwEAYDVQQDDAltYXR0
14
- am9uZXMxGDAWBgoJkiaJk/IsZAEZFgh5aWVsZGJvdDETMBEGCgmSJomT8ixkARkW
15
- A2NvbTAeFw0xNTAxMjgyMTAyNTFaFw0xNjAxMjgyMTAyNTFaMEMxEjAQBgNVBAMM
16
- CW1hdHRqb25lczEYMBYGCgmSJomT8ixkARkWCHlpZWxkYm90MRMwEQYKCZImiZPy
17
- LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyTSzVYnO
18
- CLgyrIyT1mBQakArQyW8xhi6MlDqyzXHJGeERT790U6EgoBVeS4XoK0ptFZNR8Tf
19
- zko0w+Nv47TarSCgkPOaxY+mxWnAVR10dOmfeLr7huiMyps+YD56/EF2FqQ3jf/+
20
- qohENfKD91qy1ieEy+Fn7Pf74ltbNKUdkb9a9eFXQ0DQ4ip5vik7DzjQkUTj4lca
21
- k6ArwnmHX4YDhZoYtrQJ8jVktN0/+NtA40M5qkCYHNe5tUW25b/tKVYuioxG6b2Z
22
- oIzaZxRLxf6HVAWpCVRT/F5+/yjigkX4u++eYacfLGleXQzoK7BL65vHGMJygWEE
23
- 0TKGqFOrl/L0AQIDAQABo38wfTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
24
- HQ4EFgQUEf6a8Td7MrSZc8ImbLFZAENPbz0wIQYDVR0RBBowGIEWbWF0dGpvbmVz
25
- QHlpZWxkYm90LmNvbTAhBgNVHRIEGjAYgRZtYXR0am9uZXNAeWllbGRib3QuY29t
26
- MA0GCSqGSIb3DQEBBQUAA4IBAQBbzXAYA3BVGw8DZ0YYoY1VHPNEcH5qPIApmHO8
27
- rvSmuUT0yMEi7u00H/5uHRFf4LleGT/+sTdyXKsNPGT9kdRuQEgwi+vf7Zfvd8aX
28
- UF/+4VkEYf/8rV8Ere6u2QaWPgApdMV6JjKr1fAwCTd8AuGXNaWItiPPMseSQzLJ
29
- JKP4hVvbc1d+oS925B1lcBiqn2aYvElbyNAVmQPywNNqkWmvtlqj9ZVJfV5HQLdu
30
- 8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
- HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
- -----END CERTIFICATE-----
33
- date: 2015-12-30 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2016-02-04 00:00:00.000000000 Z
34
12
  dependencies:
35
13
  - !ruby/object:Gem::Dependency
36
14
  name: aws
@@ -106,84 +84,84 @@ dependencies:
106
84
  name: bundler
107
85
  requirement: !ruby/object:Gem::Requirement
108
86
  requirements:
109
- - - "~>"
87
+ - - ~>
110
88
  - !ruby/object:Gem::Version
111
89
  version: '1.7'
112
90
  type: :development
113
91
  prerelease: false
114
92
  version_requirements: !ruby/object:Gem::Requirement
115
93
  requirements:
116
- - - "~>"
94
+ - - ~>
117
95
  - !ruby/object:Gem::Version
118
96
  version: '1.7'
119
97
  - !ruby/object:Gem::Dependency
120
98
  name: codeclimate-test-reporter
121
99
  requirement: !ruby/object:Gem::Requirement
122
100
  requirements:
123
- - - "~>"
101
+ - - ~>
124
102
  - !ruby/object:Gem::Version
125
103
  version: '0.4'
126
104
  type: :development
127
105
  prerelease: false
128
106
  version_requirements: !ruby/object:Gem::Requirement
129
107
  requirements:
130
- - - "~>"
108
+ - - ~>
131
109
  - !ruby/object:Gem::Version
132
110
  version: '0.4'
133
111
  - !ruby/object:Gem::Dependency
134
112
  name: github-markup
135
113
  requirement: !ruby/object:Gem::Requirement
136
114
  requirements:
137
- - - "~>"
115
+ - - ~>
138
116
  - !ruby/object:Gem::Version
139
117
  version: '1.3'
140
118
  type: :development
141
119
  prerelease: false
142
120
  version_requirements: !ruby/object:Gem::Requirement
143
121
  requirements:
144
- - - "~>"
122
+ - - ~>
145
123
  - !ruby/object:Gem::Version
146
124
  version: '1.3'
147
125
  - !ruby/object:Gem::Dependency
148
126
  name: pry
149
127
  requirement: !ruby/object:Gem::Requirement
150
128
  requirements:
151
- - - "~>"
129
+ - - ~>
152
130
  - !ruby/object:Gem::Version
153
131
  version: '0.10'
154
132
  type: :development
155
133
  prerelease: false
156
134
  version_requirements: !ruby/object:Gem::Requirement
157
135
  requirements:
158
- - - "~>"
136
+ - - ~>
159
137
  - !ruby/object:Gem::Version
160
138
  version: '0.10'
161
139
  - !ruby/object:Gem::Dependency
162
140
  name: rake
163
141
  requirement: !ruby/object:Gem::Requirement
164
142
  requirements:
165
- - - "~>"
143
+ - - ~>
166
144
  - !ruby/object:Gem::Version
167
145
  version: '10.0'
168
146
  type: :development
169
147
  prerelease: false
170
148
  version_requirements: !ruby/object:Gem::Requirement
171
149
  requirements:
172
- - - "~>"
150
+ - - ~>
173
151
  - !ruby/object:Gem::Version
174
152
  version: '10.0'
175
153
  - !ruby/object:Gem::Dependency
176
154
  name: redcarpet
177
155
  requirement: !ruby/object:Gem::Requirement
178
156
  requirements:
179
- - - "~>"
157
+ - - ~>
180
158
  - !ruby/object:Gem::Version
181
159
  version: '3.2'
182
160
  type: :development
183
161
  prerelease: false
184
162
  version_requirements: !ruby/object:Gem::Requirement
185
163
  requirements:
186
- - - "~>"
164
+ - - ~>
187
165
  - !ruby/object:Gem::Version
188
166
  version: '3.2'
189
167
  - !ruby/object:Gem::Dependency
@@ -204,36 +182,36 @@ dependencies:
204
182
  name: rspec
205
183
  requirement: !ruby/object:Gem::Requirement
206
184
  requirements:
207
- - - "~>"
185
+ - - ~>
208
186
  - !ruby/object:Gem::Version
209
187
  version: '3.1'
210
188
  type: :development
211
189
  prerelease: false
212
190
  version_requirements: !ruby/object:Gem::Requirement
213
191
  requirements:
214
- - - "~>"
192
+ - - ~>
215
193
  - !ruby/object:Gem::Version
216
194
  version: '3.1'
217
195
  - !ruby/object:Gem::Dependency
218
196
  name: yard
219
197
  requirement: !ruby/object:Gem::Requirement
220
198
  requirements:
221
- - - "~>"
199
+ - - ~>
222
200
  - !ruby/object:Gem::Version
223
201
  version: '0.8'
224
202
  type: :development
225
203
  prerelease: false
226
204
  version_requirements: !ruby/object:Gem::Requirement
227
205
  requirements:
228
- - - "~>"
206
+ - - ~>
229
207
  - !ruby/object:Gem::Version
230
208
  version: '0.8'
231
209
  description: Sensu mailer plugins
232
- email: "<sensu-users@googlegroups.com>"
210
+ email: <sensu-users@googlegroups.com>
233
211
  executables:
234
- - handler-mailer.rb
235
- - handler-mailer-ses.rb
236
212
  - handler-mailer-mailgun.rb
213
+ - handler-mailer-ses.rb
214
+ - handler-mailer.rb
237
215
  extensions: []
238
216
  extra_rdoc_files: []
239
217
  files:
@@ -261,18 +239,19 @@ require_paths:
261
239
  - lib
262
240
  required_ruby_version: !ruby/object:Gem::Requirement
263
241
  requirements:
264
- - - ">="
242
+ - - ! '>='
265
243
  - !ruby/object:Gem::Version
266
244
  version: 1.9.3
267
245
  required_rubygems_version: !ruby/object:Gem::Requirement
268
246
  requirements:
269
- - - ">="
247
+ - - ! '>='
270
248
  - !ruby/object:Gem::Version
271
249
  version: '0'
272
250
  requirements: []
273
251
  rubyforge_project:
274
- rubygems_version: 2.4.8
252
+ rubygems_version: 2.4.5
275
253
  signing_key:
276
254
  specification_version: 4
277
255
  summary: Sensu plugins for mailer
278
256
  test_files: []
257
+ has_rdoc:
checksums.yaml.gz.sig DELETED
@@ -1,2 +0,0 @@
1
- �����D_6���#݊��M=i��KP��W��2��Ɗ��Y5��8��CC�� ;Վ=��l�/`�g�n��K�# ������Y
2
- '�߀��u�ŷy⪽n�IX6�3ׇN�I��Sq����Td|���m�Wj�����G�{�e��]�z �� ��[x{�c3/j"x\_��T�Il���a���6#6݀�fFyz�E�7�c���q�uSfbk�C�^"�pU�N���T����7q��\�kVe
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
@@ -1 +0,0 @@
1
- ���9p�����r��>�Ȃ�e�QD�`�֣�9��)Ua���s�����_ۣ�r�����z�r�Ȅ{�ى��njg ��05�Qd�u���=ƨi�qb����Wp�'h�>���]�WsR�DQX�b�������t���}�M����L%����}�@�)���4��*�������I�H�o���������B���y ,޶�2�VV5��nV�u� �ܼ�6�.�� �K6Z��4aA�}���h32���SX�4_