[PATCH] Run AnacondaExceptionHandler in cmdline mode
Vratislav Podzimek
vpodzime at redhat.com
Thu Jan 15 07:21:11 UTC 2015
On Wed, 2015-01-14 at 15:19 -0800, Brian C. Lane wrote:
> cmdline mode still needs to have the exception handler run. It exits
> anaconda when there are problems, without it you can get stuck in a loop
> in the summary hub when there are incomplete spokes.
>
> This adds an interactive argument to it so that when the handler runs in
> cmdline mode it only prints out the error and calls sys.exit(1) --
> skipping the call to the superclass from meh which tries to run a UI to
> prompt for debugging.
> ---
> anaconda | 6 ++----
> pyanaconda/exception.py | 28 +++++++++++++++++-----------
> 2 files changed, 19 insertions(+), 15 deletions(-)
>
> diff --git a/anaconda b/anaconda
> index d97b682..f27280d 100755
> --- a/anaconda
> +++ b/anaconda
> @@ -1269,10 +1269,8 @@ if __name__ == "__main__":
> if image_count:
> anaconda.storage.setupDiskImages()
>
> - # only install interactive exception handler in interactive modes
> - if ksdata.displaymode.displayMode != DISPLAY_MODE_CMDLINE or flags.debug:
> - from pyanaconda import exception
> - anaconda.mehConfig = exception.initExceptionHandling(anaconda)
> + from pyanaconda import exception
> + anaconda.mehConfig = exception.initExceptionHandling(anaconda)
>
> # add our own additional signal handlers
> signal.signal(signal.SIGUSR1, lambda signum, frame:
> diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
> index b8b8f4f..4b46802 100644
> --- a/pyanaconda/exception.py
> +++ b/pyanaconda/exception.py
> @@ -49,7 +49,7 @@ log = logging.getLogger("anaconda")
>
> class AnacondaExceptionHandler(ExceptionHandler):
>
> - def __init__(self, confObj, intfClass, exnClass, tty_num, gui_lock):
> + def __init__(self, confObj, intfClass, exnClass, tty_num, gui_lock, interactive):
> """
> :see: python-meh's ExceptionHandler
> :param tty_num: the number of tty the interface is running on
> @@ -59,6 +59,7 @@ class AnacondaExceptionHandler(ExceptionHandler):
> ExceptionHandler.__init__(self, confObj, intfClass, exnClass)
> self._gui_lock = gui_lock
> self._intf_tty_num = tty_num
> + self._interactive = interactive
>
> def run_handleException(self, dump_info):
> """
> @@ -128,15 +129,19 @@ class AnacondaExceptionHandler(ExceptionHandler):
> # X not running (Gtk cannot be initialized)
> if threadMgr.in_main_thread():
> log.debug("In the main thread, running exception handler")
> - if (issubclass (ty, CmdlineError)):
> -
> - cmdline_error_msg = _("\nThe installation was stopped due to "
> - "incomplete spokes detected while running "
> - "in non-interactive cmdline mode. Since there "
> - "cannot 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)
> + if issubclass(ty, CmdlineError) or not self._interactive:
> + if issubclass(ty, CmdlineError):
> + cmdline_error_msg = _("\nThe installation was stopped due to "
> + "incomplete spokes detected while running "
> + "in non-interactive cmdline mode. Since there "
> + "cannot 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)
> + else:
> + cmdline_error_msg = _("\nRunning in cmdline mode, no interactive debugging "
> + "allowed.\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
> @@ -259,9 +264,10 @@ def initExceptionHandling(anaconda):
> # anaconda-tb file
> conf.register_callback("journalctl", journalctl_callback, attchmnt_only=False)
>
> + interactive = not anaconda.displayMode == 'c'
> handler = AnacondaExceptionHandler(conf, anaconda.intf.meh_interface,
> ReverseExceptionDump, anaconda.intf.tty_num,
> - anaconda.gui_initialized)
> + anaconda.gui_initialized, interactive)
> handler.install(anaconda)
>
> return conf
ACK. We just need to rebase this and my patches for early HW errors, but
those still don't have any ACK, just complaints.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list