Raise an error if a file in zuul.d is empty
Currently if a file in zuul.d is empty loading it returns None and the command returns with a generic TypeError since data cannot be iterated. This change adds a more explicit error. Change-Id: I4928aac2488a92aed57018a3aa4d9f6f7650d38b
This commit is contained in:
parent
8f1cecfd74
commit
5f582c6eb3
@ -102,8 +102,12 @@ class ZuulDirective(Directive):
|
||||
def parse_zuul_d(self, path):
|
||||
layout = Layout()
|
||||
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)
|
||||
if data is None:
|
||||
raise SphinxError(
|
||||
"File %s in Zuul dir is empty", conf_path)
|
||||
for obj in data:
|
||||
if 'job' in obj:
|
||||
layout.jobs.append(obj['job'])
|
||||
|
Loading…
Reference in New Issue
Block a user