aboutsummaryrefslogtreecommitdiffstats
path: root/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'common.py')
-rw-r--r--common.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/common.py b/common.py
index 67ab208..3eb8a3e 100644
--- a/common.py
+++ b/common.py
@@ -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