Merge pull request #2101 from DarkSinclair/develop

file.managed functionality to enforce filesystem permissions when source...
This commit is contained in:
Thomas S Hatch 2012-09-26 10:55:44 -07:00
commit 4798abb19c

View File

@ -980,8 +980,9 @@ def managed(name,
file. file.
replace replace
If this file should be replaced, if false then this command will If this file should be replaced. If false, this command will
be ignored if the file exists already. Default is true. not overwrite file contents but will enforce permissions if the file
exists already. Default is true.
context context
Overrides default context variables passed to the template. Overrides default context variables passed to the template.
@ -1016,7 +1017,13 @@ def managed(name,
if not replace: if not replace:
if os.path.exists(name): if os.path.exists(name):
ret['comment'] = 'File {0} exists. No changes made'.format(name) # Check and set the permissions if necessary
ret, perms = _check_perms(name, ret, user, group, mode)
if __opts__['test']:
ret['comment'] = 'File {0} not updated'.format(name)
elif not ret['changes'] and ret['result']:
ret['comment'] = ('File {0} exists with proper permissions.'
' No changes made.').format(name)
return ret return ret
if not source: if not source:
return touch(name, makedirs=makedirs) return touch(name, makedirs=makedirs)