diff options
author | Ian Chilton <ian.chilton@bytemark.co.uk> | 2018-02-28 13:07:54 +0000 |
---|---|---|
committer | Ian Chilton <ian.chilton@bytemark.co.uk> | 2018-02-28 13:07:54 +0000 |
commit | c42a0bef7d7194989cdacc317409fa4ac0b802a0 (patch) | |
tree | d0c759084b69d6f2220ca0265f34b9979a1c0b80 /lib/custodian/alerts | |
parent | 25b1792c7adca856bedadbeae1fa4de7972c8b5b (diff) | |
parent | 1f3d5467758529812601111b8b4fdf2566abd3d4 (diff) |
Merge branch '21-allow-custom-subjects' into 'master'
Resolve "Feature: allow specifying `with subject 'foo'` in checks to declare what the Subject should be"
Closes #21
See merge request open-source/custodian!15
Diffstat (limited to 'lib/custodian/alerts')
-rw-r--r-- | lib/custodian/alerts/file.rb | 12 | ||||
-rw-r--r-- | lib/custodian/alerts/mauve.rb | 13 |
2 files changed, 19 insertions, 6 deletions
diff --git a/lib/custodian/alerts/file.rb b/lib/custodian/alerts/file.rb index 06a704e..0c7a6dd 100644 --- a/lib/custodian/alerts/file.rb +++ b/lib/custodian/alerts/file.rb @@ -31,7 +31,12 @@ module Custodian # Record a raise event for the given test. # def raise - write_message("RAISE: #{test.target} failed #{test.get_type}-test - #{test.error}") + subject = test.target + subject = test.get_subject() unless test.get_subject().nil? + + write_message("RAISE: #{subject} failed #{test.get_type}-test - #{test.error}") + + end @@ -47,7 +52,10 @@ module Custodian # Record a clear event for the given test. # def clear - write_message("CLEAR: #{test.target} failed #{test.get_type}-test") + subject = test.target + subject = test.get_subject() unless test.get_subject().nil? + + write_message("CLEAR: #{subject} failed #{test.get_type}-test") end diff --git a/lib/custodian/alerts/mauve.rb b/lib/custodian/alerts/mauve.rb index 0aed390..13ac747 100644 --- a/lib/custodian/alerts/mauve.rb +++ b/lib/custodian/alerts/mauve.rb @@ -2,7 +2,6 @@ require 'custodian/util/bytemark' require 'custodian/util/dns' -require 'custodian/util/prefix' require 'digest/sha1' @@ -228,10 +227,16 @@ module Custodian id_key += test.class.to_s alert.id = Digest::SHA1.hexdigest(id_key) - # Look for a subject-prefix - subject_prefix = Custodian::Util::Prefix.text() + # + # Set the subject of the alert + # + alert.subject = subject + + # + # But allow it to be overwritten if something was specified. + # + alert.subject = test.get_subject() unless test.get_subject().nil? - alert.subject = subject_prefix + subject alert.summary = "The #{test_type} test failed against #{test_host}" # |