Merge pull request #15727 from privateip/shell_module

handle name resolution errors more gracefully from shell.py
pull/15912/head
Peter Sprygada 9 years ago
commit 114a0596aa

@ -102,12 +102,15 @@ class Shell(object):
if not look_for_keys:
look_for_keys = password is None
self.ssh.connect(host, port=port, username=username, password=password,
timeout=timeout, look_for_keys=look_for_keys, pkey=pkey,
key_filename=key_filename, allow_agent=allow_agent)
self.shell = self.ssh.invoke_shell()
self.shell.settimeout(timeout)
try:
self.ssh.connect(host, port=port, username=username, password=password,
timeout=timeout, look_for_keys=look_for_keys, pkey=pkey,
key_filename=key_filename, allow_agent=allow_agent)
self.shell = self.ssh.invoke_shell()
self.shell.settimeout(timeout)
except socket.gaierror:
raise ShellError("unable to resolve host name")
if self.kickstart:
self.shell.sendall("\n")

Loading…
Cancel
Save