From ba6ac3f17370b83a852d5bb392119ea8caaf64bf Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Mon, 2 Apr 2007 16:00:04 +0000 Subject: * vnc.py (startVNCServer): Display the IP address of the VNC server when telling the user what to connect to. During DHCP install scenarios, users might not know the address they are assigned (#234747) --- vnc.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'vnc.py') diff --git a/vnc.py b/vnc.py index 2d7631c3c..1f61024dd 100644 --- a/vnc.py +++ b/vnc.py @@ -283,8 +283,20 @@ def startVNCServer(vncpassword="", root='/', vncconnecthost="", if vncconnecthost != "": stdoutLog.info(_("Attempting to connect to vnc client on host %s...") % (vncconnecthost,)) - - hostarg = vncconnecthost + + res = [] + try: + res = socket.getaddrinfo(vncconnecthost, None, socket.AF_INET6, socket.SOCK_STREAM) + except socket.gaierror: + try: + res = socket.getaddrinfo(vncconnecthost, None, socket.AF_INET, socket.SOCK_STREAM) + except socket.gaierror: + hostarg = vncconnecthost + + if res != []: + for (family, socktype, proto, canonname, sockaddr,) in res: + (hostarg, port,) = sockaddr + if vncconnectport != "": hostarg = hostarg + ":" + vncconnectport -- cgit