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')
|
ret, 'Defaults must be formed as a dict')
|
||||||
|
|
||||||
if not replace and os.path.exists(name):
|
if not replace and os.path.exists(name):
|
||||||
|
ret_perms = {}
|
||||||
# Check and set the permissions if necessary
|
# Check and set the permissions if necessary
|
||||||
if salt.utils.platform.is_windows():
|
if salt.utils.platform.is_windows():
|
||||||
ret = __salt__['file.check_perms'](
|
ret = __salt__['file.check_perms'](
|
||||||
@ -2514,17 +2515,17 @@ def managed(name,
|
|||||||
inheritance=win_inheritance,
|
inheritance=win_inheritance,
|
||||||
reset=win_perms_reset)
|
reset=win_perms_reset)
|
||||||
else:
|
else:
|
||||||
ret, perms = __salt__['file.check_perms'](
|
ret, ret_perms = __salt__['file.check_perms'](
|
||||||
name, ret, user, group, mode, attrs, follow_symlinks)
|
name, ret, user, group, mode, attrs, follow_symlinks)
|
||||||
if __opts__['test']:
|
if __opts__['test']:
|
||||||
if isinstance(perms, dict) and \
|
if isinstance(ret_perms, dict) and \
|
||||||
'lmode' in perms and \
|
'lmode' in ret_perms and \
|
||||||
mode != perms['lmode']:
|
mode != ret_perms['lmode']:
|
||||||
ret['comment'] = ('File {0} will be updated with permissions '
|
ret['comment'] = ('File {0} will be updated with permissions '
|
||||||
'{1} from its current '
|
'{1} from its current '
|
||||||
'state of {2}'.format(name,
|
'state of {2}'.format(name,
|
||||||
mode,
|
mode,
|
||||||
perms['lmode']))
|
ret_perms['lmode']))
|
||||||
else:
|
else:
|
||||||
ret['comment'] = 'File {0} not updated'.format(name)
|
ret['comment'] = 'File {0} not updated'.format(name)
|
||||||
elif not ret['changes'] and ret['result']:
|
elif not ret['changes'] and ret['result']:
|
||||||
|
Loading…
Reference in New Issue
Block a user