From 3006fa94d0ce4589505596eec15690134b96e8df Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Thu, 6 Jul 2006 20:03:17 +0000 Subject: On behalf of all of us here at anaconda, we wish Chris the best of luck getting his workstation back online. --- vnc.py | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'vnc.py') diff --git a/vnc.py b/vnc.py index f61619e10..b099bceb7 100644 --- a/vnc.py +++ b/vnc.py @@ -197,24 +197,22 @@ def startVNCServer(vncpassword="", root='/', vncconnecthost="", if netinfo.hostname != "localhost.localdomain" and netinfo.lookupHostname() is not None: srvname = netinfo.hostname else: - # Otherwise, look for any configured interface and use its IP - # address for the name to connect to. - for dev in netinfo.netdevices.keys(): - try: - ip = isys.getIPAddress(dev) - log.info("ip of %s is %s" %(dev, ip)) - except Exception, e: - log.warning("Got an exception trying to get the ip addr " - "of %s: %s" %(dev, e)) - continue - - if ip != '127.0.0.1' and ip is not None: - srvname = ip - break - - # If we get here and there's no valid IP address, just use the - # hostname and hope for the best (better than displaying nothing) - if ip == '127.0.0.1' or ip is None: + # Otherwise, look for the first configured interface and use its + # IP address for the name to connect to. + dev = netinfo.getFirstDeviceName() + + try: + ip = isys.getIPAddress(dev) + log.info("ip of %s is %s" % (dev, ip)) + except Exception, e: + log.warning("Got an exception trying to get the ip addr " + "of %s: %s" % (dev, e)) + + if ip != "127.0.0.1" and ip is not None: + srvname = ip + else: + # If we get here and there's no valid IP address, just use the + # hostname and hope for the best (better than displaying nothing) srvname = netinfo.hostname if srvname is not None: -- cgit