Ensure remote files are chmod'd properly for su/su_user too

Fixes #8594
pull/9012/head
James Cammarata 10 years ago
parent 0c4a7492bf
commit cdf938f2c2

@ -124,7 +124,7 @@ class ActionModule(object):
xfered = self.runner._transfer_str(conn, tmp, 'src', resultant) xfered = self.runner._transfer_str(conn, tmp, 'src', resultant)
# fix file permissions when the copy is done as a different user # fix file permissions when the copy is done as a different user
if self.runner.sudo and self.runner.sudo_user != 'root': if self.runner.sudo and self.runner.sudo_user != 'root' or self.runner.su and self.runner.su_user != 'root':
self.runner._remote_chmod(conn, 'a+r', xfered, tmp) self.runner._remote_chmod(conn, 'a+r', xfered, tmp)
# run the copy module # run the copy module

@ -227,7 +227,7 @@ class ActionModule(object):
self._remove_tempfile_if_content_defined(content, content_tempfile) self._remove_tempfile_if_content_defined(content, content_tempfile)
# fix file permissions when the copy is done as a different user # fix file permissions when the copy is done as a different user
if self.runner.sudo and self.runner.sudo_user != 'root' and not raw: if (self.runner.sudo and self.runner.sudo_user != 'root' or self.runner.su and self.runner.su_user != 'root') and not raw:
self.runner._remote_chmod(conn, 'a+r', tmp_src, tmp_path) self.runner._remote_chmod(conn, 'a+r', tmp_src, tmp_path)
if raw: if raw:

@ -113,7 +113,7 @@ class ActionModule(object):
xfered = self.runner._transfer_str(conn, tmp, 'source', resultant) xfered = self.runner._transfer_str(conn, tmp, 'source', resultant)
# fix file permissions when the copy is done as a different user # fix file permissions when the copy is done as a different user
if self.runner.sudo and self.runner.sudo_user != 'root': if self.runner.sudo and self.runner.sudo_user != 'root' or self.runner.su and self.runner.su_user != 'root':
self.runner._remote_chmod(conn, 'a+r', xfered, tmp) self.runner._remote_chmod(conn, 'a+r', xfered, tmp)
# run the copy module # run the copy module

@ -76,7 +76,7 @@ class ActionModule(object):
# handle check mode client side # handle check mode client side
# fix file permissions when the copy is done as a different user # fix file permissions when the copy is done as a different user
if copy: if copy:
if self.runner.sudo and self.runner.sudo_user != 'root': if self.runner.sudo and self.runner.sudo_user != 'root' or self.runner.su and self.runner.su_user != 'root':
self.runner._remote_chmod(conn, 'a+r', tmp_src, tmp) self.runner._remote_chmod(conn, 'a+r', tmp_src, tmp)
# Build temporary module_args. # Build temporary module_args.
new_module_args = dict( new_module_args = dict(

Loading…
Cancel
Save