From 35bfdd5faf76d1f6bbac890a5ce17ad39174e1d6 Mon Sep 17 00:00:00 2001 From: Jakub Michalski Date: Mon, 4 Dec 2023 10:49:08 +0100 Subject: [PATCH] Handle empty summaries in ssystem-report --- .../protoplaster_system_report.py | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/protoplaster/report_generators/system_report/protoplaster_system_report.py b/protoplaster/report_generators/system_report/protoplaster_system_report.py index 819242b..5ed7a2c 100755 --- a/protoplaster/report_generators/system_report/protoplaster_system_report.py +++ b/protoplaster/report_generators/system_report/protoplaster_system_report.py @@ -124,18 +124,23 @@ def run_command(config): out = get_cmd_output(f"sh -c '{config.script}'") summaries = [] for summary_config in config.summary_configs: - summary_content = subprocess.check_output( - f"sh -c '{summary_config.script}'", - shell=True, - text=True, - stderr=subprocess.STDOUT, - env=os.environ | { - "PROTOPLASTER_SCRIPTS": - f"{os.path.dirname(__file__)}/scripts" - }, - input=out) - summaries.append( - SubReportSummary(summary_config.title, summary_content)) + try: + summary_content = subprocess.check_output( + f"sh -c '{summary_config.script}'", + shell=True, + text=True, + stderr=subprocess.STDOUT, + env=os.environ | { + "PROTOPLASTER_SCRIPTS": + f"{os.path.dirname(__file__)}/scripts" + }, + input=out) + summaries.append( + SubReportSummary(summary_config.title, summary_content)) + except: + summaries.append( + SubReportSummary(summary_config.title, + "this summary is empty")) return SubReportResult(config.name, out, config.output_file, summaries) except: if config.on_fail: