diff options
author | Paul Sherwood <paul.sherwood@codethink.co.uk> | 2016-08-26 09:09:35 +0100 |
---|---|---|
committer | Paul Sherwood <paul.sherwood@codethink.co.uk> | 2016-08-26 09:09:35 +0100 |
commit | c069aba9ffbf936b31465015695abd7f50e2c630 (patch) | |
tree | 6219e420bb89f35fc1736ce54e8feca43a76b886 | |
parent | 340be128dc6e70226bce22b5225bd512a28f7104 (diff) | |
download | ybd-c069aba9ffbf936b31465015695abd7f50e2c630.tar.gz |
Check every field in every definition
-rw-r--r-- | ybd/config/defaults.conf | 7 | ||||
-rw-r--r-- | ybd/morphs.py | 10 |
2 files changed, 13 insertions, 4 deletions
diff --git a/ybd/config/defaults.conf b/ybd/config/defaults.conf index 9b09d34..f44bb8b 100644 --- a/ybd/config/defaults.conf +++ b/ybd/config/defaults.conf @@ -1,19 +1,26 @@ # Valid fields in a morph file morph-fields: ['arch', + 'artifacts', 'build-depends', + 'build-mode', 'build-system', 'chunks', 'configuration-extensions', + 'contents', 'description', 'devices', 'kind', 'max-jobs', 'morph', 'name', + 'path', + 'prefix', 'products', 'strata', 'ref', + 'repo', 'subsystems', + 'submodules', 'systems', 'system-integration', 'unpetrify-ref'] diff --git a/ybd/morphs.py b/ybd/morphs.py index 95c51d0..78f7913 100644 --- a/ybd/morphs.py +++ b/ybd/morphs.py @@ -45,6 +45,12 @@ class Morphs(object): data['path'] = self._demorph(path[2:]) self._fix_keys(data) self._tidy_and_insert_recursively(data) + for x in self._data: + dn = self._data[x] + for field in dn: + if field not in self.fields: + log(dn, 'Invalid field "%s" in' % field, dn['path'], + exit=True) def _load(self, path): '''Load a single definition file as a dict. @@ -57,10 +63,6 @@ class Morphs(object): with open(path) as f: text = f.read() contents = yaml.safe_load(text) - for field in contents: - if field not in self.fields: - log('DEFINITIONS', 'Invalid field "%s" in' % field, - path, exit=True) except yaml.YAMLError, exc: log('DEFINITIONS', 'Could not parse %s' % path, exc, exit=True) |