Merge pull request #23957 from rallytime/bp-23951

Backport #23951 to 2015.5
This commit is contained in:
Justin Findlay 2015-05-19 21:04:24 -06:00
commit 2d185f78f7

View file

@ -3643,7 +3643,11 @@ def copy(
try:
shutil.copy(source, name)
ret['changes'] = {name: source}
__salt__['file.check_perms'](name, ret, user, group, mode)
# Preserve really means just keep the behavior of the cp command. If
# the filesystem we're copying to is squashed or doesn't support chown
# then we shouldn't be checking anything.
if not preserve:
__salt__['file.check_perms'](name, ret, user, group, mode)
except (IOError, OSError):
return _error(
ret, 'Failed to copy "{0}" to "{1}"'.format(source, name))