Commit 453a4cc6 authored by Maximilian Dolling's avatar Maximilian Dolling

added escape for report if no subreport is found

parent c2c2c8aa
......@@ -67,9 +67,11 @@ report_time = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
# consolidate subreports
report_dict = {'report version': report_version}
subreport_found = False
for root, dirs, files in os.walk(working_dir, topdown=False):
for file in files:
if file.endswith('.yml'):
subreport_found = True
subreport_path = os.path.join(root, file)
with open(subreport_path) as subreport_yml:
subreport_dict = yaml.load(subreport_yml, Loader=yaml.FullLoader)
......@@ -78,6 +80,11 @@ for root, dirs, files in os.walk(working_dir, topdown=False):
if cleanup:
shutil.rmtree(Path(subreport_path).parent)
# do not try to generate report if there is nothing to put into it.
if not subreport_found:
print('No subreport found. please run at least one other service to generate a report.')
sys.exit(1)
# changes to report to match test output, if test is running
# delete timestamp, last commit hash and set language values to 0 due to frequent changes
if test:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment