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

[PATCH] pykickstart now raises KickstartError instead of IOError.



---
 pyanaconda/kickstart.py |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 4bafb27..85ceec8 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -1239,15 +1239,7 @@ def preScriptPass(anaconda, file):
 
     try:
         ksparser.readKickstart(file)
-    except IOError, e:
-        if anaconda.intf:
-            anaconda.intf.kickstartErrorWindow("Could not open kickstart file or included file named %s" % e.filename)
-            sys.exit(1)
-        else:
-            stderrLog.critical(_("The following error was found while parsing the kickstart "
-                              "configuration file:\n\n%s") % e)
-            sys.exit(1)
-    except KickstartError, e:
+    except (KickstartValueError, KickstartParseError) as e:
        if anaconda.intf:
            anaconda.intf.kickstartErrorWindow(e.__str__())
            sys.exit(1)
@@ -1255,6 +1247,14 @@ def preScriptPass(anaconda, file):
             stderrLog.critical(_("The following error was found while parsing the kickstart "
                               "configuration file:\n\n%s") % e)
             sys.exit(1)
+    except KickstartError as e:
+        if anaconda.intf:
+            anaconda.intf.kickstartErrorWindow("Could not open kickstart file or included file named %s" % file)
+            sys.exit(1)
+        else:
+            stderrLog.critical(_("The following error was found while parsing the kickstart "
+                              "configuration file:\n\n%s") % e)
+            sys.exit(1)
 
     # run %pre scripts
     runPreScripts(anaconda, ksparser.handler.scripts)
@@ -1283,19 +1283,19 @@ def parseKickstart(anaconda, file):
 
     try:
         ksparser.readKickstart(file)
-    except IOError, e:
-        # We may not have an intf now, but we can do better than just raising
-        # the exception.
+    except (KickstartValueError, KickstartParseError) as e:
         if anaconda.intf:
-            anaconda.intf.kickstartErrorWindow("Could not open kickstart file or included file named %s" % e.filename)
+            anaconda.intf.kickstartErrorWindow(e.__str__())
             sys.exit(1)
         else:
             stderrLog.critical(_("The following error was found while parsing the kickstart "
                               "configuration file:\n\n%s") % e)
             sys.exit(1)
-    except KickstartError, e:
+    except KickstartError as e:
+        # We may not have an intf now, but we can do better than just raising
+        # the exception.
         if anaconda.intf:
-            anaconda.intf.kickstartErrorWindow(e.__str__())
+            anaconda.intf.kickstartErrorWindow("Could not open kickstart file or included file named %s" % file)
             sys.exit(1)
         else:
             stderrLog.critical(_("The following error was found while parsing the kickstart "
-- 
1.7.1.1


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