Merge "Toplevel collection typecheck."

This commit is contained in:
Jenkins 2014-02-20 00:45:15 +00:00 committed by Gerrit Code Review
commit ca01c62187

View File

@ -120,6 +120,10 @@ class YamlParser(object):
def parse(self, fn): def parse(self, fn):
data = yaml.load(open(fn)) data = yaml.load(open(fn))
if data: if data:
if not isinstance(data, list):
raise JenkinsJobsException(
"The topmost collection in file '{fname}' must be a list,"
" not a {cls}".format(fname=fn, cls=type(data)))
for item in data: for item in data:
cls, dfn = item.items()[0] cls, dfn = item.items()[0]
group = self.data.get(cls, {}) group = self.data.get(cls, {})