diff --git a/core/src/epicli/cli/engine/schema/DefaultMerger.py b/core/src/epicli/cli/engine/schema/DefaultMerger.py index 531f1d41fa..c250815e87 100644 --- a/core/src/epicli/cli/engine/schema/DefaultMerger.py +++ b/core/src/epicli/cli/engine/schema/DefaultMerger.py @@ -29,7 +29,10 @@ def merge_parent(self, files, doc): merged_parent['version'] = VERSION merge_objdict(merged_parent, doc) return merged_parent + default_config = select_first(self.docs, lambda x: x.name == 'default' and x.kind == doc.kind) default_doc = select_first(files, lambda x: x.name == 'default') + if default_config is not None: + merge_objdict(default_doc, default_config) default_doc['version'] = VERSION merge_objdict(default_doc, doc) return default_doc \ No newline at end of file diff --git a/core/src/epicli/cli/helpers/config_merger.py b/core/src/epicli/cli/helpers/config_merger.py index b5f6d6cb9f..aa872a6ef9 100644 --- a/core/src/epicli/cli/helpers/config_merger.py +++ b/core/src/epicli/cli/helpers/config_merger.py @@ -1,6 +1,8 @@ +from copy import deepcopy + from cli.helpers.doc_list_helpers import select_first from cli.helpers.data_loader import load_all_yaml_objs, types -from cli.helpers.objdict_helpers import merge_objdict +from cli.helpers.objdict_helpers import merge_objdict, dict_to_objdict from cli.version import VERSION @@ -8,10 +10,11 @@ def merge_with_defaults(provider, feature_kind, config_selector, docs): files = load_all_yaml_objs(types.DEFAULT, provider, feature_kind) config_spec = select_first(files, lambda x: x.name == config_selector) if config_selector != 'default': - default_config = select_first(docs, lambda x: x.name == 'default' and x.kind == feature_kind) - if default_config is None: - default_config = select_first(files, lambda x: x.name == 'default') - default_config['version'] = VERSION - merge_objdict(default_config, config_spec) - return default_config + default_config = dict_to_objdict(deepcopy(select_first(docs, lambda x: x.name == 'default' and x.kind == feature_kind))) + default_doc = select_first(files, lambda x: x.name == 'default') + if default_config is not None: + merge_objdict(default_doc, default_config) + merge_objdict(default_doc, config_spec) + default_doc['version'] = VERSION + return default_doc return config_spec