mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
Merge pull request #15727 from privateip/shell_module
handle name resolution errors more gracefully from shell.py
This commit is contained in:
commit
114a0596aa
1 changed files with 8 additions and 5 deletions
|
@ -102,12 +102,15 @@ class Shell(object):
|
||||||
if not look_for_keys:
|
if not look_for_keys:
|
||||||
look_for_keys = password is None
|
look_for_keys = password is None
|
||||||
|
|
||||||
self.ssh.connect(host, port=port, username=username, password=password,
|
try:
|
||||||
timeout=timeout, look_for_keys=look_for_keys, pkey=pkey,
|
self.ssh.connect(host, port=port, username=username, password=password,
|
||||||
key_filename=key_filename, allow_agent=allow_agent)
|
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 = self.ssh.invoke_shell()
|
||||||
self.shell.settimeout(timeout)
|
self.shell.settimeout(timeout)
|
||||||
|
except socket.gaierror:
|
||||||
|
raise ShellError("unable to resolve host name")
|
||||||
|
|
||||||
if self.kickstart:
|
if self.kickstart:
|
||||||
self.shell.sendall("\n")
|
self.shell.sendall("\n")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue