FIXES #462: fix extends merge

This commit is contained in:
Muayyad alsadi 2022-03-28 13:32:22 +03:00
parent ebb3dfe634
commit d05cad4c65

View File

@ -1150,6 +1150,8 @@ def normalize(compose):
normalize_service(service) normalize_service(service)
return compose return compose
def clone(value):
return value.copy() if is_list(value) or is_dict(value) else value
def rec_merge_one(target, source): def rec_merge_one(target, source):
""" """
@ -1159,7 +1161,7 @@ def rec_merge_one(target, source):
for key, value in source.items(): for key, value in source.items():
if key in target: if key in target:
continue continue
target[key] = value target[key] = clone(value)
done.add(key) done.add(key)
for key, value in target.items(): for key, value in target.items():
if key in done: if key in done:
@ -1168,7 +1170,7 @@ def rec_merge_one(target, source):
continue continue
value2 = source[key] value2 = source[key]
if key == "command": if key == "command":
target[key] = value2 target[key] = clone(value2)
continue continue
if not isinstance(value2, type(value)): if not isinstance(value2, type(value)):
value_type = type(value) value_type = type(value)