blob: 9ac027c70a5eb96f8c187756ff678a5043291450 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#
# 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
|