|
|
@ -188,12 +188,13 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
|
|
|
|
except AttributeError:
|
|
|
|
except AttributeError:
|
|
|
|
s = ansible.constants.DEFAULT_REMOTE_TMP # <=2.4.x
|
|
|
|
s = ansible.constants.DEFAULT_REMOTE_TMP # <=2.4.x
|
|
|
|
|
|
|
|
|
|
|
|
return self._remote_expand_user(s)
|
|
|
|
return self._remote_expand_user(s, sudoable=False)
|
|
|
|
|
|
|
|
|
|
|
|
def _make_tmp_path(self, remote_user=None):
|
|
|
|
def _make_tmp_path(self, remote_user=None):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Replace the base implementation's use of shell to implement mkdtemp()
|
|
|
|
Replace the base implementation's use of shell to implement mkdtemp()
|
|
|
|
with an actual call to mkdtemp().
|
|
|
|
with an actual call to mkdtemp(). Like vanilla, the directory is always
|
|
|
|
|
|
|
|
created in the login account context.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
LOG.debug('_make_tmp_path(remote_user=%r)', remote_user)
|
|
|
|
LOG.debug('_make_tmp_path(remote_user=%r)', remote_user)
|
|
|
|
|
|
|
|
|
|
|
@ -281,20 +282,26 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Replace the base implementation's attempt to emulate
|
|
|
|
Replace the base implementation's attempt to emulate
|
|
|
|
os.path.expanduser() with an actual call to os.path.expanduser().
|
|
|
|
os.path.expanduser() with an actual call to os.path.expanduser().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:param bool sudoable:
|
|
|
|
|
|
|
|
If :data:`True`, indicate unqualified tilde ("~" with no username)
|
|
|
|
|
|
|
|
should be evaluated in the context of the login account, not any
|
|
|
|
|
|
|
|
become_user.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
LOG.debug('_remote_expand_user(%r, sudoable=%r)', path, sudoable)
|
|
|
|
LOG.debug('_remote_expand_user(%r, sudoable=%r)', path, sudoable)
|
|
|
|
if not path.startswith('~'):
|
|
|
|
if not path.startswith('~'):
|
|
|
|
# /home/foo -> /home/foo
|
|
|
|
# /home/foo -> /home/foo
|
|
|
|
return path
|
|
|
|
return path
|
|
|
|
if path == '~':
|
|
|
|
if sudoable or not self._play_context.become:
|
|
|
|
# ~ -> /home/dmw
|
|
|
|
if path == '~':
|
|
|
|
return self._connection.homedir
|
|
|
|
# ~ -> /home/dmw
|
|
|
|
if path.startswith('~/'):
|
|
|
|
return self._connection.homedir
|
|
|
|
# ~/.ansible -> /home/dmw/.ansible
|
|
|
|
if path.startswith('~/'):
|
|
|
|
return os.path.join(self._connection.homedir, path[2:])
|
|
|
|
# ~/.ansible -> /home/dmw/.ansible
|
|
|
|
if path.startswith('~'):
|
|
|
|
return os.path.join(self._connection.homedir, path[2:])
|
|
|
|
# ~root/.ansible -> /root/.ansible
|
|
|
|
# ~root/.ansible -> /root/.ansible
|
|
|
|
return self.call(os.path.expanduser, mitogen.utils.cast(path))
|
|
|
|
return self.call(os.path.expanduser, mitogen.utils.cast(path),
|
|
|
|
|
|
|
|
use_login_context=not sudoable)
|
|
|
|
|
|
|
|
|
|
|
|
def get_task_timeout_secs(self):
|
|
|
|
def get_task_timeout_secs(self):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|