Fix loading empty yaml files with include_dir_named (#107853)

This commit is contained in:
Pedro Lamas
2024-01-16 09:23:04 +00:00
committed by GitHub
parent 5afe155cd9
commit 6cab4486f7
2 changed files with 2 additions and 5 deletions

View File

@@ -359,10 +359,7 @@ def _include_dir_named_yaml(loader: LoaderType, node: yaml.nodes.Node) -> NodeDi
filename = os.path.splitext(os.path.basename(fname))[0]
if os.path.basename(fname) == SECRET_YAML:
continue
loaded_yaml = load_yaml(fname, loader.secrets)
if loaded_yaml is None:
continue
mapping[filename] = loaded_yaml
mapping[filename] = load_yaml(fname, loader.secrets)
return _add_reference(mapping, loader, node)

View File

@@ -193,7 +193,7 @@ def test_include_dir_list_recursive(
),
(
{"/test/first.yaml": "1", "/test/second.yaml": None},
{"first": 1},
{"first": 1, "second": None},
),
],
)