Remove tmp as a parameter to the connection plugins

There doesn't appear to be anything that actually uses tmp_path in the
connection plugins so we don't need to pass that in to exec_command.
That change also means that we don't need to pass tmp_path around in
many places in the action plugins any more.  there may be more cleanup
that can be done there as well (the action plugin's public run() method
takes tmp as a keyword arg but that may not be necessary).

As a sideeffect of this patch, some potential problems with chmod and
the patch, assemble, copy, and template modules has been fixed (those
modules called _remote_chmod() with the wrong order for their
parameters.  Removing the tmp parameter fixed them.)
This commit is contained in:
Toshio Kuratomi 2015-09-24 13:29:36 -07:00
parent 95b371dd60
commit a1428d6bed
24 changed files with 81 additions and 73 deletions

View file

@ -132,7 +132,7 @@ class ActionModule(ActionBase):
tmp = self._make_tmp_path()
# expand any user home dir specifier
dest = self._remote_expand_user(dest, tmp)
dest = self._remote_expand_user(dest)
diffs = []
for source_full, source_rel in source_files:
@ -153,7 +153,7 @@ class ActionModule(ActionBase):
dest_file = self._connection._shell.join_path(dest)
# Attempt to get the remote checksum
remote_checksum = self._remote_checksum(tmp, dest_file, all_vars=task_vars)
remote_checksum = self._remote_checksum(dest_file, all_vars=task_vars)
if remote_checksum == '3':
# The remote_checksum was executed on a directory.
@ -164,7 +164,7 @@ class ActionModule(ActionBase):
else:
# Append the relative source location to the destination and retry remote_checksum
dest_file = self._connection._shell.join_path(dest, source_rel)
remote_checksum = self._remote_checksum(tmp, dest_file, all_vars=task_vars)
remote_checksum = self._remote_checksum(dest_file, all_vars=task_vars)
if remote_checksum != '1' and not force:
# remote_file does not exist so continue to next iteration.
@ -181,7 +181,7 @@ class ActionModule(ActionBase):
tmp = self._make_tmp_path()
if self._play_context.diff and not raw:
diffs.append(self._get_diff_data(tmp, dest_file, source_full, task_vars))
diffs.append(self._get_diff_data(dest_file, source_full, task_vars))
if self._play_context.check_mode:
self._remove_tempfile_if_content_defined(content, content_tempfile)
@ -202,7 +202,7 @@ class ActionModule(ActionBase):
# fix file permissions when the copy is done as a different user
if self._play_context.become and self._play_context.become_user != 'root':
self._remote_chmod('a+r', tmp_src, tmp)
self._remote_chmod('a+r', tmp_src)
if raw:
# Continue to next iteration if raw is defined.