mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #50653 from lexvella/2018.3
Check file_mode in file.directory and _check_directory
This commit is contained in:
commit
264a04292d
1 changed files with 6 additions and 2 deletions
|
@ -677,6 +677,7 @@ def _check_directory(name,
|
|||
group=None,
|
||||
recurse=False,
|
||||
mode=None,
|
||||
file_mode=None,
|
||||
clean=False,
|
||||
require=False,
|
||||
exclude_pat=None,
|
||||
|
@ -712,6 +713,7 @@ def _check_directory(name,
|
|||
if check_files:
|
||||
for fname in files:
|
||||
fchange = {}
|
||||
mode = file_mode
|
||||
path = os.path.join(root, fname)
|
||||
stats = __salt__['file.stats'](
|
||||
path, None, follow_symlinks
|
||||
|
@ -720,6 +722,8 @@ def _check_directory(name,
|
|||
fchange['user'] = user
|
||||
if group is not None and group != stats.get('group'):
|
||||
fchange['group'] = group
|
||||
if mode is not None and mode != stats.get('mode'):
|
||||
fchange['mode'] = mode
|
||||
if fchange:
|
||||
changes[path] = fchange
|
||||
if check_dirs:
|
||||
|
@ -3119,8 +3123,8 @@ def directory(name,
|
|||
win_perms_reset=win_perms_reset)
|
||||
else:
|
||||
presult, pcomment, pchanges = _check_directory(
|
||||
name, user, group, recurse or [], dir_mode, clean, require,
|
||||
exclude_pat, max_depth, follow_symlinks)
|
||||
name, user, group, recurse or [], dir_mode, file_mode, clean,
|
||||
require, exclude_pat, max_depth, follow_symlinks)
|
||||
|
||||
if pchanges:
|
||||
ret['pchanges'].update(pchanges)
|
||||
|
|
Loading…
Add table
Reference in a new issue