diff options
author | Adam Outler <[email protected]> | 2023-06-19 22:35:53 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2023-06-20 05:35:53 +0300 |
commit | db3f6220238da8138c670924a074477987790fbe (patch) | |
tree | 66a086a240d6f44485e9dc460dbc1fe5b326dbf5 /kvmd/yamlconf/loader.py | |
parent | 9879a9f05b07d329b8db140e58d78f6005b2d76a (diff) |
Refactoring merge Method into a New Class & Adding Unit Tests (#137)
Diffstat (limited to 'kvmd/yamlconf/loader.py')
-rw-r--r-- | kvmd/yamlconf/loader.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kvmd/yamlconf/loader.py b/kvmd/yamlconf/loader.py index 55bc7aa6..ffd69e3e 100644 --- a/kvmd/yamlconf/loader.py +++ b/kvmd/yamlconf/loader.py @@ -22,6 +22,8 @@ import os +from .. import tools + from typing import IO from typing import Any @@ -30,7 +32,7 @@ import yaml.nodes import yaml.resolver import yaml.constructor -from .. import tools +from .merger import yaml_merge # ===== @@ -70,9 +72,9 @@ class _YamlLoader(yaml.SafeLoader): for child in sorted(os.listdir(inc_path)): child_path = os.path.join(inc_path, child) if os.path.isfile(child_path) or os.path.islink(child_path): - tools.merge(tree, (load_yaml_file(child_path) or {})) + yaml_merge(tree, (load_yaml_file(child_path) or {}), child_path) else: # Try file - tools.merge(tree, (load_yaml_file(inc_path) or {})) + yaml_merge(tree, (load_yaml_file(inc_path) or {}), inc_path) return tree |