aws-alert-monitor 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.0.2:
2
+
3
+ * Don't send message if destination is nil
4
+
1
5
  ## 0.0.1:
2
6
 
3
7
  * Initial release
@@ -30,21 +30,23 @@ module AwsAlertMonitor
30
30
  message_source = policy['email']['source']
31
31
  message_destination = policy['email']['destination']
32
32
 
33
- @logger.info "Sending alert to #{message_destination}."
33
+ if message_destination
34
+ @logger.info "Sending alert to #{message_destination}."
34
35
 
35
- options = { :source => message_source,
36
- :destination => { :to_addresses => [ message_destination ] },
37
- :message => { :subject => {
38
- :data => "Alert: #{@name}"
39
- },
40
- :body => {
41
- :text => {
42
- :data => @message_data
36
+ options = { :source => message_source,
37
+ :destination => { :to_addresses => [ message_destination ] },
38
+ :message => { :subject => {
39
+ :data => "Alert: #{@name}"
40
+ },
41
+ :body => {
42
+ :text => {
43
+ :data => @message_data
44
+ }
43
45
  }
44
- }
45
- }
46
- }
47
- ses.send_email options
46
+ }
47
+ }
48
+ ses.send_email options
49
+ end
48
50
  end
49
51
 
50
52
  def process_message(message)
@@ -1,3 +1,3 @@
1
1
  module AwsAlertMonitor
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -26,4 +26,10 @@ describe AwsAlertMonitor::Alert do
26
26
  @alert.process(@options).should be_false
27
27
  end
28
28
 
29
+ it "should not send the message if the destination is nil" do
30
+ @ses_mock.should_receive(:send_email).never
31
+ @options = {:name => 'test app', :message=>@message, :events=>{"autoscaling:EC2_INSTANCE_LAUNCH"=>{"email"=>{"source"=>"brett_weaver@intuit.com"}}}}
32
+ @alert.process(@options).should be_true
33
+ end
34
+
29
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-alert-monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-05 00:00:00.000000000 Z
12
+ date: 2012-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70301913625820 !ruby/object:Gem::Requirement
16
+ requirement: &70255243628260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70301913625820
24
+ version_requirements: *70255243628260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70301913624940 !ruby/object:Gem::Requirement
27
+ requirement: &70255243627260 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.11.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70301913624940
35
+ version_requirements: *70255243627260
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: aws-sdk
38
- requirement: &70301913624420 !ruby/object:Gem::Requirement
38
+ requirement: &70255243626760 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 1.7.1
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70301913624420
46
+ version_requirements: *70255243626760
47
47
  description: I watch an SQS queue and escalate alert messages.
48
48
  email:
49
49
  - brett@weav.net
@@ -91,7 +91,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  segments:
93
93
  - 0
94
- hash: 2186495264378659725
94
+ hash: -3488440908198489919
95
95
  required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  segments:
102
102
  - 0
103
- hash: 2186495264378659725
103
+ hash: -3488440908198489919
104
104
  requirements: []
105
105
  rubyforge_project:
106
106
  rubygems_version: 1.8.16