Skip to content

Commit 4aee8e5

Browse files
committed
Fix yaml update logic.
1 parent e98e6a4 commit 4aee8e5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/gold_tests/autest-site/trafficserver.test.ext

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -561,16 +561,17 @@ class YAMLFile(File):
561561
else:
562562
return content # Already an object.
563563

564-
def __update(self, content, out):
564+
def __update(self, content: dict, out: dict):
565565
for key, value in content.items():
566566
if key in out:
567-
if isinstance(out[key], dict) == False:
568-
out.update(content)
567+
if not isinstance(out[key], dict):
568+
# Simple: just set the value.
569+
out[key] = value
569570
continue
570571

572+
# Recurse: update the nested dictionary.
571573
self.__update(value, out[key])
572574
else:
573-
out[key] = {}
574575
out[key] = value
575576

576577
def update(self, content):
@@ -606,7 +607,6 @@ class RecordsYAML(YAMLFile):
606607
def __legacy_update(self, obj, new_doc=False):
607608
config = {}
608609
for name, value in obj.items():
609-
ori_name = name
610610
if name.startswith("proxy.config."):
611611
name = name[len("proxy.config."):]
612612
elif name.startswith("local.config."):

0 commit comments

Comments
 (0)