Improve errors from update-test-platforms
Instead of getting a confusing stacktrace when someone adds a new file that is missing the final project entry we now give a friendlier error that also recommends way to address the issue. Change-Id: I5a84d3a20e847eeb2d5d843ef970b5790532683c
This commit is contained in:
parent
ac6119dd94
commit
d27c7ff9db
@ -20,6 +20,7 @@
|
|||||||
# of the repo.
|
# of the repo.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
from ruamel.yaml.comments import CommentedMap
|
from ruamel.yaml.comments import CommentedMap
|
||||||
|
|
||||||
@ -127,6 +128,18 @@ def handle_file(fn):
|
|||||||
outdata.append(obj)
|
outdata.append(obj)
|
||||||
# We control the last project stanza
|
# We control the last project stanza
|
||||||
outdata.extend(outprojects)
|
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 = outprojects[-1]['project']
|
||||||
project['check']['jobs'] = joblist_check
|
project['check']['jobs'] = joblist_check
|
||||||
# Use the same dictionary if there are no non-voting jobs
|
# Use the same dictionary if there are no non-voting jobs
|
||||||
|
Loading…
Reference in New Issue
Block a user