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.
pull/836/head
Stephen Fromm 12 years ago
parent f9bdfde614
commit 569d377183

@ -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:

Loading…
Cancel
Save