1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Wrap paramiko open_session() call in try/except

Ran across non-unix host where the call to paramiko's open_session() in
exec_command() would throw a EOFError exception.  This change wraps the
block in a try/except.
This commit is contained in:
Stephen Fromm 2012-08-09 21:47:09 -07:00
parent f9bdfde614
commit 569d377183

View file

@ -81,7 +81,13 @@ class ParamikoConnection(object):
''' run a command on the remote host '''
bufsize = 4096
chan = self.ssh.get_transport().open_session()
try:
chan = self.ssh.get_transport().open_session()
except Exception, e:
msg = "Failed to open session"
if len(str(e)) > 0:
msg += ": %s" % str(e)
raise errors.AnsibleConnectionFailed(msg)
chan.get_pty()
if not self.runner.sudo or not sudoable: