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:
parent
f9bdfde614
commit
569d377183
1 changed files with 7 additions and 1 deletions
|
@ -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…
Reference in a new issue