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 +----- lib/custodian/util/prefix.rb | 42 ------------------------------------------ 2 files changed, 1 insertion(+), 47 deletions(-) delete mode 100644 lib/custodian/util/prefix.rb 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}" # diff --git a/lib/custodian/util/prefix.rb b/lib/custodian/util/prefix.rb deleted file mode 100644 index 743a422..0000000 --- a/lib/custodian/util/prefix.rb +++ /dev/null @@ -1,42 +0,0 @@ - - -# -# This class allows a custom-prefix to be prepended to any alert -# subjects. -# -module Custodian - - module Util - - class Prefix - - - # - # Return the custom-prefix to use, if any. - # - def Prefix.text() - # Default to no prefix. - default = "" - - # Look for matches - last one wins. - Dir.glob( "/store/clients/*/custodian-prefix.cfg" ).each do |file| - begin - default = File.read( file ) - rescue Errno::EACCES - # Permission-denied. - end - end - - # Remove any newline characters - default.gsub!( /[\r\n]/, '' ) - - # Truncate, if required. - max = 32 - default = default[0...max] if ( default.length > max ) - - default - end - - end - end -end -- cgit v1.2.1