mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-04 15:40:20 -07:00
Do not use a tuple as argument for _create_connection (#3655)
This commit is contained in:
parent
abfc8d36a8
commit
73a33c02a9
1 changed files with 3 additions and 3 deletions
|
@ -326,7 +326,7 @@ def _convert_host_to_hex(host):
|
||||||
ips.append((family, hexip_hf))
|
ips.append((family, hexip_hf))
|
||||||
return ips
|
return ips
|
||||||
|
|
||||||
def _create_connection( (host, port), connect_timeout):
|
def _create_connection(host, port, connect_timeout):
|
||||||
"""
|
"""
|
||||||
Connect to a 2-tuple (host, port) and return
|
Connect to a 2-tuple (host, port) and return
|
||||||
the socket object.
|
the socket object.
|
||||||
|
@ -413,7 +413,7 @@ def main():
|
||||||
break
|
break
|
||||||
elif port:
|
elif port:
|
||||||
try:
|
try:
|
||||||
s = _create_connection( (host, port), connect_timeout)
|
s = _create_connection(host, port, connect_timeout)
|
||||||
s.shutdown(socket.SHUT_RDWR)
|
s.shutdown(socket.SHUT_RDWR)
|
||||||
s.close()
|
s.close()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
@ -459,7 +459,7 @@ def main():
|
||||||
elif port:
|
elif port:
|
||||||
alt_connect_timeout = math.ceil(_timedelta_total_seconds(end - datetime.datetime.now()))
|
alt_connect_timeout = math.ceil(_timedelta_total_seconds(end - datetime.datetime.now()))
|
||||||
try:
|
try:
|
||||||
s = _create_connection((host, port), min(connect_timeout, alt_connect_timeout))
|
s = _create_connection(host, port, min(connect_timeout, alt_connect_timeout))
|
||||||
except:
|
except:
|
||||||
# Failed to connect by connect_timeout. wait and try again
|
# Failed to connect by connect_timeout. wait and try again
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue