Toplevel collection typecheck.

Change-Id: I4a59d1b9391adb84f4a29520a179f8cdbc61e18d
This commit is contained in:
Jaroslav Henner 2014-02-04 15:38:36 +01:00
parent a32288a573
commit 2fe4ed2e34

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, {})