From 3def8a94b11cea37c8ea25764bb18ad0e68ade02 Mon Sep 17 00:00:00 2001 From: Matthew Stidham Date: Tue, 20 Jul 2021 13:28:42 -0700 Subject: [PATCH] HTML and PDF report links on a single line in the Ghost report Signed-off-by: Matthew Stidham --- py-dashboard/GhostRequest.py | 15 +++++------- py-scripts/cv_manager.py | 47 ++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 9 deletions(-) create mode 100755 py-scripts/cv_manager.py diff --git a/py-dashboard/GhostRequest.py b/py-dashboard/GhostRequest.py index 0cd82f66..1b0faaa5 100644 --- a/py-dashboard/GhostRequest.py +++ b/py-dashboard/GhostRequest.py @@ -360,10 +360,10 @@ class GhostRequest: if 'pdf' in file: url = 'http://%s/%s/%s/%s/%s/%s' % ( ghost_host, customer.strip('/'), testbed, test_run, target_folder, file) - pdfs.append('PDF of results: %s
' % (url, file)) + pdfs.append('PDF of results: %s' % (url, file)) if 'index.html' in files: url = 'http://%s/%s/%s/%s/%s' % ( - ghost_host, customer.strip('/'), testbed, target_folder, 'index.html') + ghost_host, customer.strip('/'), testbed, target_folder, target_folder) webpages.append('Results webpage: Index of report
' % url) scp_push.close() self.upload_images(target_folder) @@ -471,13 +471,10 @@ class GhostRequest: dut_table = dut_table + '' text = text + dut_table - for pdf in pdfs: - print(pdf) - text = text + pdf - - for page in webpages: - print(page) - text = text + page + for article in zip(pdfs, webpages): + if self.debug: + print(article) + text = text + article[0] + ' | ' + article[1] for image in images: text = text + image diff --git a/py-scripts/cv_manager.py b/py-scripts/cv_manager.py new file mode 100755 index 00000000..95d578b7 --- /dev/null +++ b/py-scripts/cv_manager.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 + +import sys +import os +import argparse + +if sys.version_info[0] != 3: + print("This script requires Python 3") + exit(1) + +if 'py-json' not in sys.path: + sys.path.append(os.path.join(os.path.abspath('..'), 'py-json')) + sys.path.append(os.path.join(os.path.abspath('..'), 'py-dashboard')) + +from cv_test_manager import cv_test +from cv_test_manager import * + + +class CVManager(cv_test): + def __init__(self, + scenario=None, + debug=False, + lfclient_host='localhost'): + self.scenario = scenario + self.debug = debug + self.exit_on_error = False + self.lfclient_host = lfclient_host + + def apply_and_build_scenario(self): + self.apply_cv_scenario(self.scenario) + self.build_cv_scenario() + +def main(): + parser = argparse.ArgumentParser(description='''This is a simple driver script to load a CV Scenario''') + parser.add_argument('--scenario', help='Scenario you wish to build') + parser.add_argument('--debug', help='Enable debugging', default=False, action="store_true") + parser.add_argument('--mgr', default='localhost') + + args = parser.parse_args() + + manager = CVManager(scenario=args.scenario, + debug=args.debug, + lfclient_host=args.mgr) + manager.apply_and_build_scenario() + +if __name__ =="__main__": + main() \ No newline at end of file