Skip to content

Commit e02d79a

Browse files
committed
[base] Minor simplification of _merge_config
1 parent dde3c9b commit e02d79a

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

netjsonconfig/backends/base/backend.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,11 @@ def _merge_config(self, config, templates):
6161
if not isinstance(templates, list):
6262
raise TypeError('templates argument must be an instance of list')
6363
# merge templates with main configuration
64-
base_config = {}
65-
for template in templates:
66-
base_config = merge_config(base_config, self._load(template), self.list_identifiers)
67-
if base_config:
68-
return merge_config(base_config, config, self.list_identifiers)
69-
return config
64+
result = {}
65+
config_list = [config] + templates
66+
for merging in config_list:
67+
result = merge_config(result, self._load(merging), self.list_identifiers)
68+
return result
7069

7170
def _evaluate_vars(self, config, context):
7271
"""

0 commit comments

Comments
 (0)