Merge "Raise an error if a file in zuul.d is empty"

This commit is contained in:
Zuul 2019-04-02 14:50:14 +00:00 committed by Gerrit Code Review
commit 3cae816ab4
1 changed files with 5 additions and 1 deletions

View File

@ -104,8 +104,12 @@ class ZuulDirective(Directive):
def parse_zuul_d(self, path): def parse_zuul_d(self, path):
layout = Layout() layout = Layout()
for conf in os.listdir(path): for conf in os.listdir(path):
with open(os.path.join(path, conf)) as f: conf_path = os.path.join(path, conf)
with open(conf_path) as f:
data = yaml.load(f, Loader=ZuulSafeLoader) data = yaml.load(f, Loader=ZuulSafeLoader)
if data is None:
raise SphinxError(
"File %s in Zuul dir is empty", conf_path)
for obj in data: for obj in data:
if 'job' in obj: if 'job' in obj:
layout.jobs.append(obj['job']) layout.jobs.append(obj['job'])