genesis_util: apply_patch appends to empty list with warning
This commit is contained in:
parent
a1b00b2749
commit
7d9d96fe63
1 changed files with 3 additions and 0 deletions
|
|
@ -31,6 +31,9 @@ def main():
|
||||||
with open(filename, "r") as f:
|
with open(filename, "r") as f:
|
||||||
patch = json.load(f)
|
patch = json.load(f)
|
||||||
for k, v in patch.get("append", {}).items():
|
for k, v in patch.get("append", {}).items():
|
||||||
|
if k not in genesis:
|
||||||
|
genesis[k] = []
|
||||||
|
sys.stderr.write("[WARN] item {k} was created\n".format(k=k))
|
||||||
genesis[k].extend(v)
|
genesis[k].extend(v)
|
||||||
sys.stderr.write("appended {n} items to {k}\n".format(n=len(v), k=k))
|
sys.stderr.write("appended {n} items to {k}\n".format(n=len(v), k=k))
|
||||||
for k, v in patch.get("replace", {}).items():
|
for k, v in patch.get("replace", {}).items():
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue