summaryrefslogtreecommitdiffstats
path: root/pyanaconda/vnc.py
diff options
context:
space:
mode:
authorJesse Keating <jkeating@redhat.com>2012-06-28 16:41:04 -0700
committerJesse Keating <jkeating@redhat.com>2012-06-28 16:43:52 -0700
commit29f4ed3f2b83fad2a1209105819b4b67f61fb194 (patch)
treec2c2007ae76ac8aeeecc7f8d270806baeed7fc16 /pyanaconda/vnc.py
parent167a0e193969b9ce531684637eaf7e89e35bad69 (diff)
downloadanaconda-29f4ed3f2b83fad2a1209105819b4b67f61fb194.tar.gz
anaconda-29f4ed3f2b83fad2a1209105819b4b67f61fb194.tar.xz
anaconda-29f4ed3f2b83fad2a1209105819b4b67f61fb194.zip
Make use of common code to fetch IP
Diffstat (limited to 'pyanaconda/vnc.py')
-rw-r--r--pyanaconda/vnc.py28
1 files changed, 10 insertions, 18 deletions
diff --git a/pyanaconda/vnc.py b/pyanaconda/vnc.py
index a7ccc7643..2f876502b 100644
--- a/pyanaconda/vnc.py
+++ b/pyanaconda/vnc.py
@@ -80,23 +80,11 @@ class VncServer:
# see if we can sniff out network info
netinfo = network.Network()
- devices = netinfo.netdevices
- active_devs = network.getActiveNetDevs()
-
- self.ip = None
- if active_devs != []:
- devname = devices[active_devs[0]].iface
- try:
- ips = (isys.getIPAddresses(devname, version=4) +
- isys.getIPAddresses(devname, version=6))
- except Exception as e:
- log.warning("Got an exception trying to get the self.ip addr "
- "of %s: %s" % (devname, e))
- else:
- if ips and ips[0] not in ("127.0.0.1", "::1"):
- log.info("IPs (using first) of device %s: %s" % (devname,
- ips))
- self.ip = ips[0]
+ self.ip = netinfo.getFirstRealIP()
+
+ if not self.ip:
+ # Raise this here which will be caught higher up
+ raise Exception("No IP addresses found.")
ipstr = self.ip
@@ -187,7 +175,11 @@ class VncServer:
self.log.info(_("Starting VNC..."))
# Lets call it from here for now.
- self.initialize()
+ try:
+ self.initialize()
+ except Exception, e:
+ stdoutLog.critical("Could not initialize the VNC server: %s" % e)
+ sys.exit(1)
if self.password and len(self.password) < 6:
self.changeVNCPasswdWindow()