[stable-2.10] Improve error message when ssh client is not found on the host (#70122) (#70386)

* Add changlelog
(cherry picked from commit 70bb2b33ca)

Co-authored-by: Mykola Grygoriev <nickgryg@gmail.com>

Co-authored-by: Mykola Grygoriev <nickgryg@gmail.com>
This commit is contained in:
Sam Doran 2020-07-17 15:40:38 -04:00 committed by GitHub
parent 7dfda4026e
commit d0e37aeec1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 6 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- SSH plugin - Improve error message when ssh client is not found on the host

View file

@ -818,12 +818,17 @@ class Connection(ConnectionBase):
p = None p = None
if not p: if not p:
if PY3 and conn_password: try:
# pylint: disable=unexpected-keyword-arg if PY3 and conn_password:
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, pass_fds=self.sshpass_pipe) # pylint: disable=unexpected-keyword-arg
else: p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stderr=subprocess.PIPE, pass_fds=self.sshpass_pipe)
stdin = p.stdin else:
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdin = p.stdin
except (OSError, IOError) as e:
raise AnsibleError('Unable to execute ssh command line on a controller due to: %s' % to_native(e))
# If we are using SSH password authentication, write the password into # If we are using SSH password authentication, write the password into
# the pipe we opened in _build_command. # the pipe we opened in _build_command.