Skip to content
Snippets Groups Projects
Commit 8008cee2 authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Changed tester email subject (refs #20994).

parent b83fabd9
No related branches found
No related tags found
No related merge requests found
......@@ -345,14 +345,24 @@ class Tester():
log('Too many consecutive tester failures: %s, no email will be sent.' % consecutive_failures)
if send_email:
recipients = utils.get_conf('EMAIL_ADMINS')
mediaserver_name = utils.get_conf('MS_SERVER_NAME')
system_domain = utils.get_conf('MS_SERVER_NAME')
system_type = 'MediaServer'
if system_domain == 'mediaserver':
system_domain = utils.get_conf('CM_SERVER_NAME')
system_type = 'CampusManager'
if system_domain == 'campusmanager':
system_domain = utils.get_conf('MONITOR_SERVER_NAME')
system_type = 'CampusManager'
if system_domain == 'monitor':
system_domain = 'Server'
system_type = '-'
if not recipients:
log('No recipients defined for email sending. Set a value for EMAIL_ADMINS.')
return 1
boundary = str(uuid.uuid4())
mail = '''From: %(hostname)s <support@ubicast.eu>
To: %(recipients)s
Subject: %(mediaserver_name)s (%(hostname)s) MediaServer health report: %(status)s
Subject: %(system_domain)s (%(hostname)s) %(system_type)s health report: %(status)s
Mime-Version: 1.0
Content-type: multipart/related; boundary="%(boundary)s"
......@@ -377,7 +387,8 @@ Content-transfer-encoding: utf-8
report=html_report,
log_name=log_name,
log_content=log_content,
mediaserver_name=mediaserver_name,
system_domain=system_domain,
system_type=system_type,
)
p = subprocess.Popen(['sendmail', '-t'], stdin=subprocess.PIPE, stdout=sys.stdout.stream, stderr=sys.stderr.stream)
p.communicate(input=mail.encode('utf-8'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment