First check ipv4 then ipv6 connectivity

Change-Id: Iaeca19457d78f4f6c4b3bd8091194be31563e5e5
Closes-Bug: #1819834
This commit is contained in:
GongYongSheng 2019-03-13 15:24:17 +08:00 committed by GongYongSheng
parent 8a30b3ccab
commit 4dcd870881
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)