Fix 'wait_for' doesn't work with ipv6only host

This commit is contained in:
Andrey Trubachev 2015-01-03 10:32:27 +03:00
parent 0d551d8d24
commit 659c6d3a7e

View file

@ -351,10 +351,8 @@ def main():
except IOError: except IOError:
break break
elif port: elif port:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(connect_timeout)
try: try:
s.connect( (host, port) ) s = socket.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)
@ -397,10 +395,8 @@ def main():
elapsed = datetime.datetime.now() - start elapsed = datetime.datetime.now() - start
module.fail_json(msg="Failed to stat %s, %s" % (path, e.strerror), elapsed=elapsed.seconds) module.fail_json(msg="Failed to stat %s, %s" % (path, e.strerror), elapsed=elapsed.seconds)
elif port: elif port:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(connect_timeout)
try: try:
s.connect( (host, port) ) s = socket.create_connection( (host, port), connect_timeout)
if search_regex: if search_regex:
data = '' data = ''
matched = False matched = False