Commit 1dcc3de3 authored by Peter Hutterer's avatar Peter Hutterer
Browse files

Ensure that we're only using keys we know about


Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent f40baa17
......@@ -18,6 +18,12 @@ if __name__ == '__main__':
with open(src_folder / 'globals.yml') as fd:
globs = yaml.load(fd, Loader=yaml.Loader)['globals']
# load the example so we can verify for wrong keys in the distribution
# files
with open(src_folder / 'distribution.example') as fd:
root = next(iter(yaml.load(fd, Loader=yaml.Loader).values()))
allowed_keys = tuple(root.keys())
special_files = ('globals.yml')
for distrib in [x for x in src_folder.iterdir()
if (x.name.endswith('.yml') and x.name not in special_files)]:
......@@ -26,6 +32,9 @@ if __name__ == '__main__':
# for each root element in each yaml file
for config in data.values():
for key in config:
assert key in allowed_keys, f'Invalid key: {key}'
# add missing keys from the globals
for key, value in globs.items():
assert key not in config
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment