From 395d8d5308fbea4edcc4711d8d3c903b1cf96d6a Mon Sep 17 00:00:00 2001 From: hwikle-lanl <154543628+hwikle-lanl@users.noreply.github.com> Date: Tue, 18 Feb 2025 12:44:18 -0700 Subject: [PATCH] Fix merge error when keys missing in config (#819) --- lib/yaml_config/structures.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/yaml_config/structures.py b/lib/yaml_config/structures.py index 080a064f4..657641ceb 100644 --- a/lib/yaml_config/structures.py +++ b/lib/yaml_config/structures.py @@ -410,6 +410,9 @@ def get_sub_comments(self, show_choices, show_name): def merge(self, old, new): + if old is None: + return new + base = old.copy() if new is None: @@ -422,7 +425,7 @@ def merge(self, old, new): old[key], value) elif value is not None: try: - base[key] = self.config_elems[key].merge(old[key], new[key]) + base[key] = self.config_elems[key].merge(old.get(key), new[key]) except: raise @@ -788,6 +791,10 @@ def validate(self, value, partial=False): return out_dict def merge(self, old, new): + + if old is None: + return new + base = old.copy() if new is None: