mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Accounting for when permissions are not returned from file.check_perms, eg. windows systems.
This commit is contained in:
parent
53ba0689a8
commit
a155fd7650
@ -2503,6 +2503,7 @@ def managed(name,
|
||||
ret, 'Defaults must be formed as a dict')
|
||||
|
||||
if not replace and os.path.exists(name):
|
||||
ret_perms = {}
|
||||
# Check and set the permissions if necessary
|
||||
if salt.utils.platform.is_windows():
|
||||
ret = __salt__['file.check_perms'](
|
||||
@ -2514,17 +2515,17 @@ def managed(name,
|
||||
inheritance=win_inheritance,
|
||||
reset=win_perms_reset)
|
||||
else:
|
||||
ret, perms = __salt__['file.check_perms'](
|
||||
ret, ret_perms = __salt__['file.check_perms'](
|
||||
name, ret, user, group, mode, attrs, follow_symlinks)
|
||||
if __opts__['test']:
|
||||
if isinstance(perms, dict) and \
|
||||
'lmode' in perms and \
|
||||
mode != perms['lmode']:
|
||||
if isinstance(ret_perms, dict) and \
|
||||
'lmode' in ret_perms and \
|
||||
mode != ret_perms['lmode']:
|
||||
ret['comment'] = ('File {0} will be updated with permissions '
|
||||
'{1} from its current '
|
||||
'state of {2}'.format(name,
|
||||
mode,
|
||||
perms['lmode']))
|
||||
ret_perms['lmode']))
|
||||
else:
|
||||
ret['comment'] = 'File {0} not updated'.format(name)
|
||||
elif not ret['changes'] and ret['result']:
|
||||
|
Loading…
Reference in New Issue
Block a user