diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2024-06-08 00:54:56 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2024-06-09 17:28:12 +0200 |
commit | 681c3d11b4fc02c416467d074ef0b4d84bf0cdab (patch) | |
tree | 8bfb7cfb133ae5ea3fbecf2efeef23802d39731b /common.py | |
parent | b29079ab12087f3fdd1cbbd209e205f205aaf267 (diff) |
config.yml: Allow configuration setting at the layer root.
We'll need that for layer creation (description, fields, creation
options, etc.).
Diffstat (limited to 'common.py')
-rw-r--r-- | common.py | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -42,11 +42,18 @@ def load_config(path=None, groupnames=None): # validate sources destinations = {} - for name, layer in layers.items(): - if isinstance(layer, dict): - layers[name] = layer = [layer] - - for sourcedef in layer: + for name, layerdefs in layers.items(): + if isinstance(layerdefs, dict) and 'sources' not in layerdefs: + layers[name] = { 'sources': [layerdefs] } + for k in ['description', 'create']: + if k in layerdefs: + layers[name][k] = layerdefs.pop(k) + layerdefs = layers[name] + + if 'sources' not in layerdefs: + raise Exception(f'Layer "{name}" does not have any source receipe') + + for sourcedef in layerdefs.get('sources', []): source = sourcedef.get('source', None) if source is None: continue |