Merge "First check ipv4 then ipv6 connectivity"

This commit is contained in:
Zuul 2019-03-18 14:43:36 +00:00 committed by Gerrit Code Review
commit dcc624c450
1 changed files with 6 additions and 2 deletions

View File

@ -165,12 +165,16 @@ def wait_for_ssh_port(host):
if (now - start) > constants.ENABLE_SSH_ADMIN_SSH_PORT_TIMEOUT:
raise exceptions.DeploymentError(
"Timed out waiting for port 22 from %s" % host)
# first check ipv4 then check ipv6
try:
socket.socket().connect((host, 22))
return
except socket.error:
pass
try:
socket.socket(socket.AF_INET6).connect((host, 22))
return
except socket.error:
pass
time.sleep(1)