Do not substitute ssh_exeuctable until we need to
We need to use ssh_executable instead of hardcoding ssh in the command we run but we need to use "ssh" when we lookup the value of the {command}_extra_args variable. Do this by leaving binary as "ssh" and only expanding when we place it into b_command. Fixes #20862
This commit is contained in:
parent
d2569fa6e2
commit
62ba084003
1 changed files with 7 additions and 7 deletions
|
@ -158,7 +158,10 @@ class Connection(ConnectionBase):
|
||||||
self.sshpass_pipe = os.pipe()
|
self.sshpass_pipe = os.pipe()
|
||||||
b_command += [b'sshpass', b'-d' + to_bytes(self.sshpass_pipe[0], nonstring='simplerepr', errors='surrogate_or_strict')]
|
b_command += [b'sshpass', b'-d' + to_bytes(self.sshpass_pipe[0], nonstring='simplerepr', errors='surrogate_or_strict')]
|
||||||
|
|
||||||
b_command += [to_bytes(binary, errors='surrogate_or_strict')]
|
if binary == 'ssh':
|
||||||
|
b_command += [to_bytes(self._play_context.ssh_executable, errors='surrogate_or_strict')]
|
||||||
|
else:
|
||||||
|
b_command += [to_bytes(binary, errors='surrogate_or_strict')]
|
||||||
|
|
||||||
#
|
#
|
||||||
# Next, additional arguments based on the configuration.
|
# Next, additional arguments based on the configuration.
|
||||||
|
@ -608,13 +611,10 @@ class Connection(ConnectionBase):
|
||||||
# data into /usr/bin/python inside a tty automatically invokes the
|
# data into /usr/bin/python inside a tty automatically invokes the
|
||||||
# python interactive-mode but the modules are not compatible with the
|
# python interactive-mode but the modules are not compatible with the
|
||||||
# interactive-mode ("unexpected indent" mainly because of empty lines)
|
# interactive-mode ("unexpected indent" mainly because of empty lines)
|
||||||
|
|
||||||
ssh_executable = self._play_context.ssh_executable
|
|
||||||
|
|
||||||
if not in_data and sudoable:
|
if not in_data and sudoable:
|
||||||
args = (ssh_executable, '-tt', self.host, cmd)
|
args = ('ssh', '-tt', self.host, cmd)
|
||||||
else:
|
else:
|
||||||
args = (ssh_executable, self.host, cmd)
|
args = ('ssh', self.host, cmd)
|
||||||
|
|
||||||
cmd = self._build_command(*args)
|
cmd = self._build_command(*args)
|
||||||
(returncode, stdout, stderr) = self._run(cmd, in_data, sudoable=sudoable)
|
(returncode, stdout, stderr) = self._run(cmd, in_data, sudoable=sudoable)
|
||||||
|
@ -773,7 +773,7 @@ class Connection(ConnectionBase):
|
||||||
# temporarily disabled as we are forced to currently close connections after every task because of winrm
|
# temporarily disabled as we are forced to currently close connections after every task because of winrm
|
||||||
# if self._connected and self._persistent:
|
# if self._connected and self._persistent:
|
||||||
# ssh_executable = self._play_context.ssh_executable
|
# ssh_executable = self._play_context.ssh_executable
|
||||||
# cmd = self._build_command(ssh_executable, '-O', 'stop', self.host)
|
# cmd = self._build_command('ssh', '-O', 'stop', self.host)
|
||||||
#
|
#
|
||||||
# cmd = map(to_bytes, cmd)
|
# cmd = map(to_bytes, cmd)
|
||||||
# p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
# p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
|
Loading…
Reference in a new issue