diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rwxr-xr-x | anaconda | 22 | ||||
-rw-r--r-- | kickstart.py | 68 |
3 files changed, 13 insertions, 81 deletions
@@ -23,6 +23,10 @@ * packages.py (betaNagScreen): Remove extra brace. + * anaconda (setVNCFromKickstart): Run the kickstart file through the + new %ksappend handler in pykickstart. + * kickstart.py (pullRemainingKickstartConfig): Moved to pykickstart. + 2007-07-13 Chris Lumens <clumens@redhat.com> * partedUtils.py (DiskSet.openDevices): Build up a list of drives @@ -247,23 +247,19 @@ def parseOptions(): return op.parse_args() def setVNCFromKickstart(opts): - from kickstart import pullRemainingKickstartConfig, KickstartError - from kickstart import VNCHandler - from pykickstart.parser import KickstartParser + from kickstart import KickstartError, VNCHandler + from pykickstart.parser import KickstartParser, preprocessKickstart global vncpassword, vncconnecthost, vncconnectport try: - rc = pullRemainingKickstartConfig(opts.ksfile) + opts.ksfile = preprocessKickstart(opts.ksfile) except KickstartError, msg: - rc = msg + stdoutLog.critical(_("Error processing %%ksappend lines: %s") % e) + sys.exit(1) except Exception, e: - log.error("Unknown error grabbing ks.cfg: %s" %(e,)) - rc = _("Unknown Error") - - if rc is not None: - stdoutLog.critical(_("Error pulling second part of kickstart config: %s!") % rc) - sys.exit(1) + stdoutLog.critical(_("Unknown error processing %%ksappend lines: %s") % e) + sys.exit(1) # now see if they enabled vnc via the kickstart file. Note that command # line options for password, connect host and port override values in @@ -834,7 +830,7 @@ if __name__ == "__main__": got_bad_edid = True opts.display_mode = 't' - if opts.display_mode == 't' and graphical_failed and not opts.ksfile: + if opts.display_mode == 't' and graphical_failed and not anaconda.isKickstart: ret = vnc.askVncWindow() if ret != -1: opts.display_mode = 'g' @@ -850,7 +846,7 @@ if __name__ == "__main__": if got_bad_edid: msg = "anaconda was unable to detect your monitor, possibly due to the presence of a KVM. The installation will proceed in text mode. Please run system-config-display after installation to configure your monitor." - if opts.ksfile: + if anaconda.isKickstart: log.warning(msg) else: anaconda.intf.messageWindow("Unknown monitor", msg) diff --git a/kickstart.py b/kickstart.py index 7d3f7abfc..b34b7d22f 100644 --- a/kickstart.py +++ b/kickstart.py @@ -864,74 +864,6 @@ def processKickstartFile(anaconda, file): anaconda.id.setKsdata(handler) -# look through ksfile and if it contains any lines: -# -# %ksappend <url> -# -# pull <url> down and stick it in /tmp/ks.cfg in place of the %ksappend line. -# This is run before we actually parse the complete kickstart file. -# -# Main use is to have the ks.cfg you send to the loader be minimal, and then -# use %ksappend to pull via https anything private (like passwords, etc) in -# the second stage. -def pullRemainingKickstartConfig(ksfile): - # Open the input kickstart file and read it all into a list. - try: - inF = open(ksfile, "r") - except: - raise KickstartError ("Unable to open ks file %s for reading" % ksfile) - - lines = inF.readlines() - inF.close() - - # Now open an output kickstart file that we are going to write to one - # line at a time. - (outF, outName) = tempfile.mkstemp("-ks.cfg", "", "/tmp") - - for l in lines: - url = None - - ll = l.strip() - if string.find(ll, "%ksappend") == -1: - os.write(outF, l) - continue - - # Try to pull down the remote file. - try: - ksurl = string.split(ll, ' ')[1] - except: - raise KickstartError ("Illegal url for %%ksappend: %s" % ll) - - log.info("Attempting to pull additional part of ks.cfg from url %s" % ksurl) - - try: - url = grabber.urlopen (ksurl) - except grabber.URLGrabError, e: - raise KickstartError ("IOError: %s" % e.strerror) - else: - # sanity check result - sometimes FTP doesnt - # catch a file is missing - try: - clen = url.info()['content-length'] - except Exception, e: - clen = 0 - - if clen < 1: - raise KickstartError ("IOError: -1:File not found") - - # If that worked, now write the remote file to the output kickstart - # file in one burst. Then close everything up to get ready to read - # farther ahead in the input file. This allows multiple %ksappend - # lines to exist. - if url is not None: - os.write(outF, url.read()) - url.close() - - # All done - move the temp output file to the expected location. - os.close(outF) - os.rename(outName, "/tmp/ks.cfg") - return None - def runPostScripts(anaconda): if not anaconda.id.ksdata: return |