Show test results in osTicket report

* Fixes issue #19
This commit is contained in:
2Shirt 2018-09-28 13:43:18 -06:00
parent dc8f48a6b4
commit aa1fda8ac4
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -543,7 +543,8 @@ def post_drive_results(ticket_number):
# NVMe/SMART Attributes
if dev.get('NVMe Disk', False):
report.append('NVMe Attributes:')
report.append('NVMe Attributes ({}):'.format(
TESTS['NVMe/SMART']['Status'][name]))
for attrib in sorted(ATTRIBUTES['NVMe'].keys()):
if attrib in dev['nvme-cli']:
report.append('{attrib:30}{value}'.format(
@ -553,7 +554,8 @@ def post_drive_results(ticket_number):
report[-1] = report[-1].strip().replace(' ', '.')
report[-1] = report[-1].replace('_', ' ')
elif dev['smartctl'].get('ata_smart_attributes', None):
report.append('SMART Attributes:')
report.append('SMART Attributes ({}):'.format(
TESTS['NVMe/SMART']['Status'][name]))
s_table = dev['smartctl'].get('ata_smart_attributes', {}).get(
'table', {})
s_table = {a.get('id', 'Unknown'): a for a in s_table}
@ -577,7 +579,8 @@ def post_drive_results(ticket_number):
# badblocks
bb_status = TESTS['badblocks']['Status'].get(name, None)
if TESTS['badblocks']['Enabled'] and bb_status not in ['Denied', 'Skipped']:
report.append('badblocks:')
report.append('badblocks ({}):'.format(
TESTS['badblocks']['Status'][name]))
bb_result = TESTS['badblocks']['Results'].get(
name,
'ERROR: Failed to read log.')
@ -602,7 +605,8 @@ def post_drive_results(ticket_number):
oneline=True)
for c in COLORS.values():
one_line_graph = one_line_graph.replace(c, '')
report.append('I/O Benchmark:')
report.append('I/O Benchmark ({}):'.format(
TESTS['iobenchmark']['Status'][name]))
report.append(one_line_graph)
report.append('{}'.format(
TESTS['iobenchmark']['Data'][name]['Avg/Min/Max']))