From 8fed21ce4af972799634aaa4b44c09184034734a Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Thu, 22 Feb 2018 14:15:05 +0200 Subject: Removed obsolete code. The intention of this series of changes is to allow subjects to be replaced for specific tests. The idea of replacement replaced the idea of a custom-prefix - so I've removed that code before proceeding. --- lib/custodian/alerts/mauve.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'lib/custodian/alerts') diff --git a/lib/custodian/alerts/mauve.rb b/lib/custodian/alerts/mauve.rb index 0aed390..697c7fb 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,7 @@ 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() - - alert.subject = subject_prefix + subject + alert.subject = subject alert.summary = "The #{test_type} test failed against #{test_host}" # -- cgit v1.2.1 From 74d9ba8651346e8a6653a32a70ea2216c4a45f61 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Thu, 22 Feb 2018 14:23:06 +0200 Subject: If a test has a subject used, then use it. --- lib/custodian/alerts/mauve.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/custodian/alerts') diff --git a/lib/custodian/alerts/mauve.rb b/lib/custodian/alerts/mauve.rb index 697c7fb..13ac747 100644 --- a/lib/custodian/alerts/mauve.rb +++ b/lib/custodian/alerts/mauve.rb @@ -227,7 +227,16 @@ module Custodian id_key += test.class.to_s alert.id = Digest::SHA1.hexdigest(id_key) + # + # 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.summary = "The #{test_type} test failed against #{test_host}" # -- cgit v1.2.1 From 1f3d5467758529812601111b8b4fdf2566abd3d4 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Thu, 22 Feb 2018 16:05:51 +0200 Subject: Updated the file-alerter to use the subject. If a subject is specified in a test that will now be used for the raise/clear message. This allows testing of the new parser-change(s). --- lib/custodian/alerts/file.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib/custodian/alerts') 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 -- cgit v1.2.1