Use new NVMe/SMART report layout in osTicket posts

* Fixes issue #45
This commit is contained in:
2Shirt 2019-03-13 20:57:14 -06:00
parent e0c3716e08
commit 809f338cd2
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -81,8 +81,9 @@ class osTicket():
def convert_report(self, name, test):
"""Convert report into an osTicket friendly format, returns list."""
dev = test.dev
out_report = []
source_report = test.report
source_report = test.report.copy()
status = strip_colors(test.status)
status = status.replace(test.label, '').strip()
@ -90,9 +91,21 @@ class osTicket():
index = 1
if name == 'NVMe / SMART':
out_report.append('{} ({})'.format(name, status))
if not source_report:
index = 0
source_report = test.dev.generate_attribute_report()
source_report = dev.generate_attribute_report()
# Notes
if dev.nvme_smart_notes:
notes = sorted(dev.nvme_smart_notes.keys())
source_report.append('{} Notes'.format(dev.attr_type))
source_report.extend(
['..... {}'.format(line.strip()) for line in notes])
# Test Report
_report = test.report.copy()
if _report:
source_report.append(_report.pop(0))
source_report.extend(
['..... {}'.format(line.strip()) for line in _report])
elif not source_report:
index = 0
out_report.append('{} ({})'.format(name, status))