j2cfg: allow empty list/map overrides
This commit is contained in:
parent
4237fb1742
commit
e190393397
@ -278,11 +278,19 @@ def merge_dict_recurse(d1, d2: dict) -> dict:
|
||||
|
||||
map_common = {k for k in map1 if is_mapping(d2.get(k))}
|
||||
for k in map_common:
|
||||
x[k] = merge_dict_recurse(x.get(k), d2.get(k))
|
||||
y = d2.get(k)
|
||||
if not y:
|
||||
x[k] = {}
|
||||
continue
|
||||
x[k] = merge_dict_recurse(x.get(k), y)
|
||||
|
||||
seq_common = {k for k in seq1 if is_sequence(d2.get(k))}
|
||||
for k in seq_common:
|
||||
x[k] = uniq(list(x.get(k)) + list(d2.get(k)))
|
||||
y = d2.get(k)
|
||||
if not y:
|
||||
x[k] = []
|
||||
continue
|
||||
x[k] = uniq(list(x.get(k)) + list(y))
|
||||
|
||||
unmerged = (map1 - map_common) | (seq1 - seq_common)
|
||||
for k in unmerged:
|
||||
|
Loading…
Reference in New Issue
Block a user