fixes issues with authenticating using ssh-agent for ios devices

Exception was raised when trying to use ssh-agent for authentication to
ios devices.   This fix enables ssh-agent and enable use of password
protected ssh keys.  There is one additional fix to capture authentication
exceptions nicely.
This commit is contained in:
Peter Sprygada 2016-06-06 07:53:42 -04:00
commit 0a87651fc5
2 changed files with 10 additions and 2 deletions

View file

@ -27,6 +27,7 @@ except ImportError:
try:
import paramiko
from paramiko.ssh_exception import AuthenticationException
HAS_PARAMIKO = True
except ImportError:
HAS_PARAMIKO = False
@ -111,6 +112,8 @@ class Shell(object):
self.shell.settimeout(timeout)
except socket.gaierror:
raise ShellError("unable to resolve host name")
except AuthenticationException:
raise ShellError('Unable to authenticate to remote device')
if self.kickstart:
self.shell.sendall("\n")