Only include graph links in osTicket posts

This commit is contained in:
2Shirt 2020-01-22 20:10:17 -07:00
parent fd8f46be13
commit f7c6d5d3c3
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 10 additions and 6 deletions

View file

@ -48,7 +48,7 @@ THRESH_GREAT = 750 * 1024**2
# Functions
def export_io_graph(disk, log_dir, read_rates):
"""Exports PNG graph using gnuplot, returns pathlib.Path obj."""
"""Exports PNG graph using gnuplot."""
# Safety check
if not read_rates:

View file

@ -585,11 +585,12 @@ def check_io_benchmark_results(test_obj, rate_list, graph_width, state):
# osTicket - Export PNG
image_path = None
test_obj.upload_report = []
try:
image_path = graph.export_io_graph(test_obj.dev, state.log_dir, rate_list)
except RuntimeError:
# Failed to export PNG, skip upload steps below
test_obj.report.append('Failed to export graph')
# Failed to export PNG, skip uploads below
test_obj.upload_report.append('Failed to export graph')
return
# osTicket - Upload PNG
@ -598,10 +599,10 @@ def check_io_benchmark_results(test_obj, rate_list, graph_width, state):
imgur_url = graph.upload_to_imgur(image_path)
nextcloud_url = graph.upload_to_nextcloud(
image_path, state.ost.ticket_id, test_obj.dev.path.name)
test_obj.report.append(f'Imgur: {imgur_url}')
test_obj.report.append(f'Nextcloud: {nextcloud_url}')
test_obj.upload_report.append(f'Imgur: {imgur_url}')
test_obj.upload_report.append(f'Nextcloud: {nextcloud_url}')
except RuntimeError:
test_obj.report.append('Failed to upload graph')
test_obj.upload_report.append('Failed to upload graph')
def check_mprime_results(test_obj, working_dir):
@ -1301,6 +1302,9 @@ def ost_build_report(dev, dev_type):
else:
report.extend(ost_convert_report(test.report, start_index=1))
# I/O graph upload report
report.extend(getattr(test, 'upload_report', []))
# Spacer
report.append('')