diff options
author | Chris Lumens <clumens@redhat.com> | 2006-06-02 14:28:08 +0000 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2006-06-02 14:28:08 +0000 |
commit | f907516622c742a6ddf10a56cc4d17b1f451976b (patch) | |
tree | e405e6a17c92b3cb43058640db45bc0e2195c73d | |
parent | 08be22b02d26d7480099df0674c300146e324591 (diff) | |
download | anaconda-f907516622c742a6ddf10a56cc4d17b1f451976b.tar.gz anaconda-f907516622c742a6ddf10a56cc4d17b1f451976b.tar.xz anaconda-f907516622c742a6ddf10a56cc4d17b1f451976b.zip |
If we don't have a valid hostname, tell the user to connect to the IP address
instead (#191561). Try really hard to display a valid thing the user can
connect to. Also make the logic a little clearer (to me, at least).
Now if only VNC installs worked...
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | vnc.py | 26 |
2 files changed, 23 insertions, 8 deletions
@@ -1,3 +1,8 @@ +2006-06-02 Chris Lumens <clumens@redhat.com> + + * vnc.py (startVNCServer): If we don't have a valid hostname, tell + the user to connect to the IP address instead (#191561). + 2006-06-01 Chris Lumens <clumens@redhat.com> * anaconda: Set methodstr early on so we have it in runRescue. Add a @@ -191,21 +191,31 @@ def startVNCServer(vncpassword="", root='/', vncconnecthost="", # try to load /tmp/netinfo and see if we can sniff out network info netinfo = network.Network() srvname = None - if netinfo.hostname != "localhost.localdomain": - srvname = "%s" % (netinfo.hostname,) + + # If we have a real hostname that resolves against configured DNS + # servers, use that for the name to connect to. + 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.error("Got an exception trying to get the ip addr " - "of %s: %s" %(dev, e)) - continue - if ip == '127.0.0.1' or ip is None: + log.warning("Got an exception trying to get the ip addr " + "of %s: %s" %(dev, e)) continue - srvname = ip - break + + 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: + srvname = netinfo.hostname if srvname is not None: connxinfo = "%s:1" % (srvname,) |