[PATCH] Don't prompt when in cmdline mode (#869685)

Vratislav Podzimek vpodzime at redhat.com
Fri Oct 26 08:41:09 UTC 2012


On Thu, 2012-10-25 at 22:43 -0700, Jesse Keating wrote:
> cmdline mode is text mode only, so that's why this patch only touches
> the tui code.
> ---
>  pyanaconda/ui/tui/__init__.py | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/pyanaconda/ui/tui/__init__.py b/pyanaconda/ui/tui/__init__.py
> index 9f34c4a..56791ba 100644
> --- a/pyanaconda/ui/tui/__init__.py
> +++ b/pyanaconda/ui/tui/__init__.py
> @@ -21,6 +21,7 @@
>  
>  from pyanaconda import ui
>  from pyanaconda.ui import common
> +from pyanaconda.flags import flags
>  import simpleline as tui
>  from hubs.summary import SummaryHub
>  from hubs.progress import ProgressHub
> @@ -183,6 +184,9 @@ class TextUserInterface(ui.UserInterface):
>             times where anaconda cannot make a reasonable decision.  We don't
>             want to overwhelm the user with choices.
>          """
> +        if flags.automatedInstall and not flags.ksprompt:
> +            # If we're in cmdline mode, just say no.
> +            return False
>          question_window = YesNoDialog(self._app, message)
>          self._app.switch_screen_modal(question_window)
>          return question_window.answer
Do we really want to just say no in every case this code is used in
cmdline mode? It looks to me as a potential source of more bugs. I'm
afraid callers should take care of the check and not call
showYesNoQuestion in case it cannot be answered (helper function for
this can be easily created). Or maybe adding a 'default_answer'
parameter defaulting to False that will be returned in case the answer
cannot be obtained from the user? This would, however, need a change in
the UserInteraface and GraphicalUserInterface too.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list