[master/rhel7-branch] Once again fix cmdline error handling. (#1034773)

Samantha N. Bueno sbueno+anaconda at redhat.com
Tue Feb 4 16:42:17 UTC 2014


Raise cmdline error if a user attempts to install a missing pkg
during non-interactive ks install.

This also makes a minimal change to the original CmdlineError str
which was displayed.

Resolves: rhbz#1034773
---
 pyanaconda/exception.py            | 14 +++++++-------
 pyanaconda/packaging/yumpayload.py |  7 +++++++
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
index a9cdceb..13f5ba9 100644
--- a/pyanaconda/exception.py
+++ b/pyanaconda/exception.py
@@ -93,13 +93,13 @@ class AnacondaExceptionHandler(ExceptionHandler):
             sys.exit(0)
         elif (issubclass (ty, CmdlineError)):
 
-            cmdline_error_msg = _("\nThe installation was stopped due to "
-                                  "incomplete spokes detected while running "
-                                  "in non-interactive cmdline mode. Since there "
-                                  "can not be any questions in cmdline mode, "
-                                  "edit your kickstart file and retry "
-                                  "installation.\nThe exact error message is: "
-                                  "\n\n%s.\n\nThe installer will now terminate.") % str(value)
+            cmdline_error_msg = _("\nThe installation was stopped due to an "
+                                  "error which occurred while running in "
+                                  "non-interactive cmdline mode. Since there can "
+                                  "not be any questions in cmdline mode, edit "
+                                  "your kickstart file and retry installation. "
+                                  "\nThe exact error message is: \n\n%s. \n\nThe "
+                                  "installer will now terminate.") % str(value)
 
             # since there is no UI in cmdline mode and it is completely
             # non-interactive, we can't show a message window asking the user
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 4b4a226..f8b395c 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -1350,6 +1350,13 @@ reposdir=%s
             return
 
         if errorHandler.cb(exn, str(exn)) == ERROR_RAISE:
+            if flags.automatedInstall and not flags.ksprompt:
+                # If we're doing non-interactive ks install, raise CmdlineError
+                # otherwise the system will just reboot automatically
+                errtxt = _("CmdlineError: Missing package: %s" % str(exn))
+                log.error(errtxt)
+                raise CmdlineError(errtxt)
+
             # The progress bar polls kind of slowly, thus installation could
             # still continue for a bit before the quit message is processed.
             # Let's sleep forever to prevent any further actions and wait for
-- 
1.8.3.1



More information about the anaconda-patches mailing list