fix: file.directory state children_only kwarg did not work

This commit is contained in:
Ryan Addessi (raddessi) 2023-06-16 23:01:35 -06:00 committed by Pedro Algarvio
parent 86fab4e358
commit e84c047329

View file

@ -721,6 +721,7 @@ def _check_directory(
exclude_pat=None,
max_depth=None,
follow_symlinks=False,
children_only=False,
):
"""
Check what changes need to be made on a directory
@ -792,10 +793,12 @@ def _check_directory(
)
if fchange:
changes[path] = fchange
# Recurse skips root (we always do dirs, not root), so always check root:
fchange = _check_dir_meta(name, user, group, dir_mode, follow_symlinks)
if fchange:
changes[name] = fchange
# Recurse skips root (we always do dirs, not root), so check root unless
# children_only is specified:
if not children_only:
fchange = _check_dir_meta(name, user, group, dir_mode, follow_symlinks)
if fchange:
changes[name] = fchange
if clean:
keep = _gen_keep_files(name, require, walk_d)
@ -3954,6 +3957,7 @@ def directory(
exclude_pat,
max_depth,
follow_symlinks,
children_only,
)
if tchanges: