Skip to content

Commit

Permalink
Fix states.file checking directory permissions recursively
Browse files Browse the repository at this point in the history
A change was introduced in 79f6b42 (PR saltstack#50653) to check the file
mode recursively. This change introduced a variable shadow that
caused directory permission checking to fail.
  • Loading branch information
amendlik authored and Akm0d committed Jun 5, 2019
1 parent 26fd01a commit f49dd0f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions salt/states/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,13 +731,14 @@ def _check_directory(name,
group = None
if 'mode' not in recurse_set:
mode = None
file_mode = None

check_files = 'ignore_files' not in recurse_set
check_dirs = 'ignore_dirs' not in recurse_set
for root, dirs, files in walk_l:
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
Expand All @@ -746,8 +747,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 file_mode is not None and file_mode != stats.get('mode'):
fchange['mode'] = file_mode
if fchange:
changes[path] = fchange
if check_dirs:
Expand Down

0 comments on commit f49dd0f

Please sign in to comment.