ansible: fix _make_tmp_path() regression on 2.3.x.

Due to issue #177.
pull/193/head
David Wilson 7 years ago
parent a5e4a6f346
commit e5723e4f5f

@ -184,15 +184,18 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
""" """
LOG.debug('_make_tmp_path(remote_user=%r)', remote_user) LOG.debug('_make_tmp_path(remote_user=%r)', remote_user)
try:
remote_tmp = self._connection._shell.get_option('remote_tmp')
except AttributeError:
# Required for <2.4.x.
remote_tmp = '~/.ansible'
# _make_tmp_path() is basically a global stashed away as Shell.tmpdir. # _make_tmp_path() is basically a global stashed away as Shell.tmpdir.
# The copy action plugin violates layering and grabs this attribute # The copy action plugin violates layering and grabs this attribute
# directly. # directly.
self._connection._shell.tmpdir = self.call( self._connection._shell.tmpdir = self.call(
ansible_mitogen.helpers.make_temp_directory, ansible_mitogen.helpers.make_temp_directory,
base_dir=self._remote_expand_user( base_dir=self._remote_expand_user(remote_tmp),
# ~/.ansible
self._connection._shell.get_option('remote_tmp')
)
) )
LOG.debug('Temporary directory: %r', self._connection._shell.tmpdir) LOG.debug('Temporary directory: %r', self._connection._shell.tmpdir)
self._cleanup_remote_tmp = True self._cleanup_remote_tmp = True

Loading…
Cancel
Save