Skip to content

Commit 36e2ba1

Browse files
cliffmccarthyFizzadar
authored andcommitted
docs: Specify how the recursive argument to directory() works
- As described in issue #1435, the 'recursive' argument to files.directory() does not ensure recursive ownership of the entire directory tree. Only ownership of the top-level directory is checked, not that of the subdirectories and files. Specifying 'recursive=True' will have no effect if the top-level directory already matches the mode, user, and group. - This is how the operation has behaved for a long time, so changing existing functionality to check the entire tree could be undesirable. It also takes more time to check the entire tree, so doing so affects performance. A new option may be provided in the future for callers to explicitly check the whole tree when this is desired. - Documented the existing behaviour of 'recursive' in the files.directory() docstring.
1 parent ab53843 commit 36e2ba1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/pyinfra/operations/files.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,6 +1569,12 @@ def directory(
15691569
+ force_backup: set to ``False`` to remove any existing non-file when ``force=True``
15701570
+ force_backup_dir: directory to move any backup to when ``force=True``
15711571
1572+
``recursive``:
1573+
Mode is only applied recursively if the base directory mode does not match
1574+
the specified value. User and group are both applied recursively if the
1575+
base directory does not match either one; otherwise they are unchanged for
1576+
the whole tree.
1577+
15721578
**Examples:**
15731579
15741580
.. code:: python

0 commit comments

Comments
 (0)