diff options
author | Brian C. Lane <bcl@redhat.com> | 2013-01-03 09:27:54 -0800 |
---|---|---|
committer | Brian C. Lane <bcl@redhat.com> | 2013-01-04 13:26:23 -0800 |
commit | 89f010c566ca94cf025b4c0cfcec68f6e4d62bcc (patch) | |
tree | 8959b34c870f006ae88a3f4c451721d618d8e34b /pyanaconda/vnc.py | |
parent | 4f0250521c77ef61bb9f200e05c90d2202a64087 (diff) | |
download | anaconda-89f010c566ca94cf025b4c0cfcec68f6e4d62bcc.tar.gz anaconda-89f010c566ca94cf025b4c0cfcec68f6e4d62bcc.tar.xz anaconda-89f010c566ca94cf025b4c0cfcec68f6e4d62bcc.zip |
start vnc without ip address (#832510)
In some cases the vnc server may start before the system has an IP
address. This isn't a fatal problem, it just makes it harder for the
user to know where to connect their vnc client.
This adds a 5 second retry when getting the IP. If that fails it will
still start the vnc server, and will print out instructions for
how to manually discover the IP address.
Diffstat (limited to 'pyanaconda/vnc.py')
-rw-r--r-- | pyanaconda/vnc.py | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/pyanaconda/vnc.py b/pyanaconda/vnc.py index 833e2b5b2..ac26fc7ee 100644 --- a/pyanaconda/vnc.py +++ b/pyanaconda/vnc.py @@ -42,14 +42,13 @@ stdoutLog = logging.getLogger("anaconda.stdout") class VncServer: def __init__(self, display="1", root="/", ip=None, name=None, - desktop="Desktop", password="", vncconnecthost="", + password="", vncconnecthost="", vncconnectport="", log_file="/tmp/vncserver.log", pw_file="/tmp/vncpassword"): self.display = display self.root = root self.ip = ip self.name = name - self.desktop = desktop self.password = password self.vncconnecthost = vncconnecthost self.vncconnectport = vncconnectport @@ -59,6 +58,10 @@ class VncServer: self.anaconda = None self.log = logging.getLogger("anaconda.stdout") + self.desktop = _("%(productName)s %(productVersion)s installation")\ + % {'productName': product.productName, + 'productVersion': product.productVersion} + def setVNCPassword(self): """Set the vnc server password. Output to file. """ @@ -77,14 +80,19 @@ class VncServer: def initialize(self): """Here is were all the relative vars get initialized. """ - self.ip = network.getFirstRealIP() + # Network may be slow. Try for 5 seconds + tries = 5 + while tries: + self.ip = network.getFirstRealIP() + if self.ip: + break + time.sleep(1) + tries -= 1 if not self.ip: - # Raise this here which will be caught higher up - raise Exception("No IP addresses found.") + return ipstr = self.ip - try: hinfo = socket.gethostbyaddr(ipstr) except Exception as e: @@ -112,10 +120,6 @@ class VncServer: % {'productName': product.productName, 'productVersion': product.productVersion, 'name': self.name} - else: - self.desktop = _("%(productName)s %(productVersion)s installation")\ - % {'productName': product.productName, - 'productVersion': product.productVersion} def openlogfile(self): try: @@ -166,7 +170,9 @@ class VncServer: if self.connxinfo != None: self.log.info(_("Please manually connect your vnc client to %s to begin the install.") % (self.connxinfo,)) else: - self.log.info(_("Please manually connect your vnc client to begin the install.")) + self.log.info(_("Please manually connect your vnc client to <IP ADDRESS>:%s " + "to begin the install. Switch to the shell (Ctrl-B 2) and " + "run 'ip addr' to find the <IP ADDRESS>.") % (self.display,)) def startServer(self): self.log.info(_("Starting VNC...")) |