mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
salt.states.file.copy now copies file user/group ownership and permissions from source
This commit is contained in:
parent
3ce955c774
commit
03e3da4181
@ -3524,12 +3524,15 @@ def copy(name, source, force=False, makedirs=False):
|
||||
# All tests pass, move the file into place
|
||||
try:
|
||||
shutil.copy(source, name)
|
||||
source_user = __salt__['file.get_user'](source)
|
||||
source_group = __salt__['file.get_group'](source)
|
||||
source_mode = __salt__['file.get_mode'](source)
|
||||
__salt__['file.check_perms'](name, ret, source_user, source_group, source_mode)
|
||||
ret['comment'] = 'Copied "{0}" to "{1}"'.format(source, name)
|
||||
ret['changes'] = {name: source}
|
||||
except (IOError, OSError):
|
||||
return _error(
|
||||
ret, 'Failed to copy "{0}" to "{1}"'.format(source, name))
|
||||
|
||||
ret['comment'] = 'Copied "{0}" to "{1}"'.format(source, name)
|
||||
ret['changes'] = {name: source}
|
||||
return ret
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user