mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
handle name resolution errors more gracefully from shell.py
This change will catch socket.gaierror exceptions from shell.py and return a more friendly message to the user
This commit is contained in:
parent
fbec9ce58b
commit
91f67ac37a
1 changed files with 8 additions and 5 deletions
|
@ -101,12 +101,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)
|
||||
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)
|
||||
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…
Reference in a new issue