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

Log system FQDN and IP config in tester | refs #33218

parent 2adee7e1
No related branches found
No related tags found
No related merge requests found
......@@ -131,10 +131,19 @@ class Tester():
if not tests:
print('No test to run.')
sys.exit(1)
# Print system info
self.print_system_info()
# Run tests
exit_code = self.run_tests(tests, send_email=args.send_email, send_email_if_fail=args.send_email_if_fail)
sys.exit(exit_code)
def print_system_info(self):
print('System information:')
print('- Date: %s UTC.' % datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S'))
print('- FQDN: %s.' % socket.getfqdn())
p = subprocess.run(['ip', '-br', 'addr'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
print('- IP config:\n%s' % p.stdout)
def parse_file_header(self, path):
with open(path, 'r') as fo:
content = fo.read()
......@@ -526,6 +535,7 @@ Content-Type: text/html; charset=UTF-8
Content-transfer-encoding: utf-8
<p><b>Date: %(date)s UTC</b></p>
<p>FQDN: %(fqdn)s</p>
%(report)s
--%(boundary)s
......@@ -540,6 +550,7 @@ Content-transfer-encoding: %(log_content_encoding)s
recipients=recipients,
status=('KO (%s tests failed)' % failures) if failures > 0 else 'OK',
date=now.strftime('%Y-%m-%d %H:%M:%S'),
fqdn=socket.getfqdn(),
report=html_report,
log_name=log_name.replace('.log', '.txt'),
log_content_encoding=log_content_encoding,
......
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