Merge "Improve errors from update-test-platforms"

This commit is contained in:
Zuul 2020-10-25 23:26:48 +00:00 committed by Gerrit Code Review
commit 2efb34d589
1 changed files with 13 additions and 0 deletions

View File

@ -20,6 +20,7 @@
# of the repo.
import os
import sys
from ruamel.yaml.comments import CommentedMap
@ -127,6 +128,18 @@ def handle_file(fn):
outdata.append(obj)
# We control the last project stanza
outdata.extend(outprojects)
if not outprojects:
seed = """
- project:
check:
jobs: []
gate:
jobs: []
"""
print(
f"FATAL: File {fn} last item is not a project definition. "
f"Try adding something like:\n{seed}")
sys.exit(1)
project = outprojects[-1]['project']
project['check']['jobs'] = joblist_check
# Use the same dictionary if there are no non-voting jobs