From b1b8ec280c5848fd4485a5106a58ea98c37dc905 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Tue, 17 Feb 2015 20:52:41 +0000 Subject: Deal with multiple test-implementations. As soon as we allow multiple test-implementations we get into a mess, as Mauve regards an ID as unique and that is based upon the test-definition not the implementing method We want to allow: * HTTPS test to succeed. * SSL-check to fail. Which means multiple tests of type "https" will have different IDs. Force this by adding on the class of the implementation. --- lib/custodian/alerts/mauve.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/custodian/alerts/mauve.rb') diff --git a/lib/custodian/alerts/mauve.rb b/lib/custodian/alerts/mauve.rb index 66379a5..9a5d9ed 100644 --- a/lib/custodian/alerts/mauve.rb +++ b/lib/custodian/alerts/mauve.rb @@ -213,14 +213,20 @@ module Custodian test_host = test.target test_type = test.get_type - alert = Mauve::Proto::Alert.new # # Mauve only lets us use IDs which are <= 255 characters in length # hash the line from the parser to ensure it is short enough. # (IDs must be unique, per-source) - alert.id = Digest::SHA1.hexdigest(test.to_s) + # + # Because there might be N-classes which implemented the test + # we need to make sure these are distinct too. + # + id_key = test.to_s + id_key += test.class + + alert.id = Digest::SHA1.hexdigest(id_key) alert.subject = subject alert.summary = "The #{test_type} test failed against #{test_host}" -- cgit v1.2.1