mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Ignore secrets.yaml when using include_dir_named (#22929)
* ignore secrets.yaml in include_dir_named include * updating test for include_dir_named secrets ignore
This commit is contained in:
parent
c6bc47b32d
commit
c314220167
@ -157,6 +157,8 @@ def _include_dir_named_yaml(loader: SafeLineLoader,
|
||||
loc = os.path.join(os.path.dirname(loader.name), node.value)
|
||||
for fname in _find_files(loc, '*.yaml'):
|
||||
filename = os.path.splitext(os.path.basename(fname))[0]
|
||||
if os.path.basename(fname) == SECRET_YAML:
|
||||
continue
|
||||
mapping[filename] = load_yaml(fname)
|
||||
return _add_reference(mapping, loader, node)
|
||||
|
||||
|
@ -134,7 +134,7 @@ class TestYaml(unittest.TestCase):
|
||||
def test_include_dir_named(self, mock_walk):
|
||||
"""Test include dir named yaml."""
|
||||
mock_walk.return_value = [
|
||||
['/tmp', [], ['first.yaml', 'second.yaml']]
|
||||
['/tmp', [], ['first.yaml', 'second.yaml', 'secrets.yaml']]
|
||||
]
|
||||
|
||||
with patch_yaml_files({
|
||||
|
Loading…
x
Reference in New Issue
Block a user