Skip to content

Commit 8bc64df

Browse files
committed
Some more IPv6 support.
1 parent c0fea68 commit 8bc64df

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

ploy/common.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,9 +663,13 @@ def parse_ssh_keygen(text):
663663

664664

665665
def wait_for_ssh(host, port, timeout=5):
666-
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:
666+
addrinfos = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)
667+
if not addrinfos:
668+
raise socket.gaierror
669+
addrinfo = addrinfos[0]
670+
with closing(socket.socket(*addrinfo[:3])) as s:
667671
s.settimeout(timeout)
668-
if s.connect_ex((host, port)) == 0:
672+
if s.connect_ex(addrinfo[4]) == 0:
669673
if s.recv(5).startswith(b'SSH-2'):
670674
return
671675

ploy/plain.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class Instance(BaseInstance):
6464

6565
def get_host(self):
6666
if 'host' not in self.config:
67+
if 'ip' not in self.config:
68+
return self.config['ipv6']
6769
return self.config['ip']
6870
return self.config['host']
6971

0 commit comments

Comments
 (0)