summaryrefslogtreecommitdiff
path: root/lib/custodian/alerts/mauve.rb
diff options
context:
space:
mode:
authorJamie Nguyen <jamie.nguyen@bytemark.co.uk>2017-03-16 11:08:45 +0000
committerJamie Nguyen <jamie.nguyen@bytemark.co.uk>2017-03-16 11:08:45 +0000
commit567d8b3c419a52ccc52f35f37338514c1d8fa623 (patch)
tree65f15a764229450aa453ec13416d0d23d5967aa1 /lib/custodian/alerts/mauve.rb
parent65216bda8dc4dbda19699ad6ed31bac711161f1a (diff)
parent3ed213af376bcb88756a22f2ca1e5c417cd0cefb (diff)
Merge branch '7-allow-custom-prefixes' into 'master'
Resolve "Allow subject-lines to be prefixed with a custom string." See merge request !4
Diffstat (limited to 'lib/custodian/alerts/mauve.rb')
-rw-r--r--lib/custodian/alerts/mauve.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/custodian/alerts/mauve.rb b/lib/custodian/alerts/mauve.rb
index be19eec..0aed390 100644
--- a/lib/custodian/alerts/mauve.rb
+++ b/lib/custodian/alerts/mauve.rb
@@ -2,6 +2,7 @@
require 'custodian/util/bytemark'
require 'custodian/util/dns'
+require 'custodian/util/prefix'
require 'digest/sha1'
@@ -223,12 +224,14 @@ module Custodian
# 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.to_s
+ id_key = test.to_s
+ id_key += test.class.to_s
+ alert.id = Digest::SHA1.hexdigest(id_key)
- alert.id = Digest::SHA1.hexdigest(id_key)
+ # Look for a subject-prefix
+ subject_prefix = Custodian::Util::Prefix.text()
- alert.subject = subject
+ alert.subject = subject_prefix + subject
alert.summary = "The #{test_type} test failed against #{test_host}"
#