Adjusted osTicket drive report formatting

This commit is contained in:
2Shirt 2018-09-20 00:50:32 -06:00
parent 9698cfbf6d
commit dd13f7bd24
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -448,10 +448,20 @@ def post_drive_results(ticket_number):
s_table = {a.get('id', 'Unknown'): a for a in s_table}
for attrib in sorted(ATTRIBUTES['SMART'].keys()):
if attrib in s_table:
report.append('{:0>2}/{:24}{} ({})'.format(
str(hex(int(attrib))).upper()[2:],
attrib,
# Pad attributewith dots for osTicket
hex_str = '{:>2}'.format(str(hex(int(attrib))).upper()[2:])
hex_str = hex_str.replace(' ', '..')
if '.' in hex_str:
hex_str = '.' + hex_str
dec_str = '{:>3}'.format(attrib)
dec_str = dec_str.replace(' ', '..')
if '.' in dec_str:
dec_str = '.' + dec_str
report.append('{:>2}/{:>3}: {} {} ({})'.format(
hex_str,
dec_str,
s_table[attrib]['raw']['string'],
'..'*24+'.',
s_table[attrib]['name'],
))
report[-1] = report[-1].strip().replace(' ', '.')
@ -489,6 +499,9 @@ def post_drive_results(ticket_number):
line = line.strip()
if not line:
continue
# Strip colors from line
for c in COLORS.values():
line = line.replace(c, '')
report.append(line)
report.append('')