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

Changed tester sender email address | refs #33556

parent 6054568e
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,6 @@ server_packages: ...@@ -10,7 +10,6 @@ server_packages:
- celerity-utils - celerity-utils
- ubicast-mediaserver - ubicast-mediaserver
server_mail: dev-mediaserver@ubicast.eu
server_default_email_sender: "noreply@{{ server_hostname }}" server_default_email_sender: "noreply@{{ server_hostname }}"
server_email_sender: "{{ envsetup_email_sender | default(server_default_email_sender, true) }}" server_email_sender: "{{ envsetup_email_sender | default(server_default_email_sender, true) }}"
......
...@@ -13,7 +13,6 @@ manager_packages: ...@@ -13,7 +13,6 @@ manager_packages:
- ubicast-skyreach - ubicast-skyreach
manager_testing: false manager_testing: false
manager_mail: dev-mediaserver@ubicast.eu
manager_hostname: "{{ envsetup_cm_server_name }}" manager_hostname: "{{ envsetup_cm_server_name }}"
manager_default_email_sender: "noreply@{{ manager_hostname }}" manager_default_email_sender: "noreply@{{ manager_hostname }}"
manager_email_sender: "{{ envsetup_email_sender | default(manager_default_email_sender, true) }}" manager_email_sender: "{{ envsetup_email_sender | default(manager_default_email_sender, true) }}"
......
...@@ -469,9 +469,9 @@ class Tester(): ...@@ -469,9 +469,9 @@ class Tester():
if not hostname: if not hostname:
print('Failed to get hostname (required to send email).') print('Failed to get hostname (required to send email).')
return 1 return 1
fqdn = socket.getfqdn()
log_content_encoding = 'utf-8' log_content_encoding = 'utf-8'
# Send email # Get sender and recipients
sender = 'support@ubicast.eu'
recipients = get_conf('EMAIL_ADMINS') or '' recipients = get_conf('EMAIL_ADMINS') or ''
system_domain = get_conf('MS_SERVER_NAME') system_domain = get_conf('MS_SERVER_NAME')
system_type = 'MediaServer' system_type = 'MediaServer'
...@@ -483,6 +483,15 @@ class Tester(): ...@@ -483,6 +483,15 @@ class Tester():
system_type = 'Server' system_type = 'Server'
if system_domain == 'monitor': if system_domain == 'monitor':
system_type = '-' system_type = '-'
if '.' in system_domain:
top_domain = '.'.join(system_domain.split('.')[-2:])
elif '.' in fqdn:
top_domain = '.'.join(fqdn.split('.')[-2:])
else:
top_domain = system_domain + '.local'
sender = hostname + '@' + top_domain
print('Sender address: %s' % sender)
# Prepare email contant
if out_of_support: if out_of_support:
system_domain = '[OUT OF SUPPORT] %s' % system_domain system_domain = '[OUT OF SUPPORT] %s' % system_domain
recipients = recipients.replace('sysadmin@ubicast.eu', '').replace( recipients = recipients.replace('sysadmin@ubicast.eu', '').replace(
...@@ -528,7 +537,7 @@ Content-transfer-encoding: %(log_content_encoding)s ...@@ -528,7 +537,7 @@ Content-transfer-encoding: %(log_content_encoding)s
recipients=recipients, recipients=recipients,
status=('KO (%s tests failed)' % failures) if failures > 0 else 'OK', status=('KO (%s tests failed)' % failures) if failures > 0 else 'OK',
date=now.strftime('%Y-%m-%d %H:%M:%S'), date=now.strftime('%Y-%m-%d %H:%M:%S'),
fqdn=socket.getfqdn(), fqdn=fqdn,
report=html_report, report=html_report,
log_name=self.get_log_name(now).replace('.log', '.txt'), log_name=self.get_log_name(now).replace('.log', '.txt'),
log_content_encoding=log_content_encoding, log_content_encoding=log_content_encoding,
...@@ -536,6 +545,7 @@ Content-transfer-encoding: %(log_content_encoding)s ...@@ -536,6 +545,7 @@ Content-transfer-encoding: %(log_content_encoding)s
system_domain=system_domain, system_domain=system_domain,
system_type=system_type, system_type=system_type,
) )
# Send email
p = subprocess.Popen( p = subprocess.Popen(
['/usr/sbin/sendmail', '-t'], ['/usr/sbin/sendmail', '-t'],
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
......
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