[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 8/8] Don't call preprocessKickstart from within anaconda as well.



Since the loader is doing this now, we can just call it once there, then pass
the preprocessed file location into anaconda via the --kickstart parameter.
---
 loader/kickstart.c      |   10 +++++-----
 loader/kickstart.h      |    2 +-
 loader/loader.c         |   10 +++++++---
 pyanaconda/kickstart.py |    9 +--------
 4 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/loader/kickstart.c b/loader/kickstart.c
index 3374432..298b3bb 100644
--- a/loader/kickstart.c
+++ b/loader/kickstart.c
@@ -967,11 +967,11 @@ cleanup:
     Py_XDECREF(proxyObj);
 }
 
-int runKickstart(struct loaderData_s * loaderData, const char *file) {
+char *runKickstart(struct loaderData_s * loaderData, const char *file) {
     PyObject *versionMod, *parserMod = NULL;
     PyObject *handler, *parser;
     PyObject *processedFile;
-    int rc = 0;
+    char *retval = NULL;
 
     PyObject *callable = NULL;
 
@@ -1014,9 +1014,9 @@ int runKickstart(struct loaderData_s * loaderData, const char *file) {
          */
         for (cmd = ksTable; *cmd != NULL; cmd++)
             (*cmd)(loaderData, handler);
-    }
 
-    rc = 1;
+        retval = strdup(PyString_AsString(processedFile));
+    }
 
 quit:
     Py_XDECREF(constantsMod);
@@ -1024,7 +1024,7 @@ quit:
     Py_XDECREF(callable);
     Py_XDECREF(parserMod);
     Py_Finalize();
-    return rc;
+    return retval;
 }
 
 /* vim:set sw=4 sts=4 et: */
diff --git a/loader/kickstart.h b/loader/kickstart.h
index 8f1c734..8163cb7 100644
--- a/loader/kickstart.h
+++ b/loader/kickstart.h
@@ -23,7 +23,7 @@
 
 int isKickstartFileRemote(char *ksFile);
 void getKickstartFile(struct loaderData_s * loaderData);
-int runKickstart(struct loaderData_s * loaderData, const char *file);
+char *runKickstart(struct loaderData_s * loaderData, const char *file);
 int getKickstartFromBlockDevice(char *device, char *path);
 
 #endif
diff --git a/loader/loader.c b/loader/loader.c
index e980913..08b8c3c 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1824,6 +1824,7 @@ int main(int argc, char ** argv) {
 
     char ** argptr, ** tmparg;
     char * anacondaArgs[50];
+    char * outputKSFile = NULL;
 
     struct loaderData_s loaderData;
 
@@ -2139,7 +2140,7 @@ int main(int argc, char ** argv) {
         if (!ksFile)
             getKickstartFile(&loaderData);
         if (FL_KICKSTART(flags))
-            runKickstart(&loaderData, (ksFile)?ksFile:loaderData.ksFile);
+            outputKSFile = runKickstart(&loaderData, (ksFile)?ksFile:loaderData.ksFile);
     }
 
     if (FL_EARLY_NETWORKING(flags)) {
@@ -2255,9 +2256,12 @@ int main(int argc, char ** argv) {
     *argptr++ = "--headless";
 #endif
 
-    if (FL_KICKSTART(flags)) {
+    /* Pass the local, preprocessed kickstart file to anaconda.  There's no
+     * need for another fetch and another call to preprocessKickstart.
+     */
+    if (FL_KICKSTART(flags) && outputKSFile) {
         *argptr++ = "--kickstart";
-        *argptr++ = loaderData.ksFile;
+        *argptr++ = outputKSFile;
     }
 
     if (FL_SERIAL(flags))
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 6513d80..25c0cf6 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -1306,14 +1306,7 @@ def preScriptPass(anaconda, file):
     runPreScripts(anaconda, ksparser.handler.scripts)
 
 def parseKickstart(anaconda, file):
-    try:
-        file = preprocessKickstart(file)
-    except KickstartError, msg:
-        stderrLog.critical(_("Error processing %%ksappend lines: %s") % msg)
-        sys.exit(1)
-    except Exception, e:
-        stderrLog.critical(_("Unknown error processing %%ksappend lines: %s") % e)
-        sys.exit(1)
+    # preprocessing the kickstart file has already been handled by loader.
 
     handler = AnacondaKSHandler(anaconda)
     ksparser = AnacondaKSParser(handler)
-- 
1.7.1.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]