diff options
author | Chris Lumens <clumens@redhat.com> | 2007-07-16 20:42:30 +0000 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2007-07-16 20:42:30 +0000 |
commit | fc86452e1774a7438681a0e80f75242cace69e1d (patch) | |
tree | f42bed138e3ff97fc0b524ae9d11e961bf835d63 /kickstart.py | |
parent | fdb52e39cd4ba4f4987f5ae8170a6b77956f08f2 (diff) | |
download | anaconda-fc86452e1774a7438681a0e80f75242cace69e1d.tar.gz anaconda-fc86452e1774a7438681a0e80f75242cace69e1d.tar.xz anaconda-fc86452e1774a7438681a0e80f75242cace69e1d.zip |
Moved the pullRemainingKickstartConfig functionality into pykickstart.
Diffstat (limited to 'kickstart.py')
-rw-r--r-- | kickstart.py | 68 |
1 files changed, 0 insertions, 68 deletions
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 |