[master/rhel7-branch] Fix q for quit issue in text mode (#997405)
Vratislav Podzimek
vpodzime at redhat.com
Mon Sep 8 13:03:38 UTC 2014
On Mon, 2014-09-08 at 09:00 -0400, Samantha N. Bueno wrote:
> Pressing 'q' to quit the installer in the ask VNC spoke of text mode was
> not working. We can't rely on the global handling of this input,
> unfortunately, since the installation environment is not set up at this
> point. But, this should be a relatively simple way of adding the
> functionality.
>
> Resolves: rhbz#997405
> ---
> pyanaconda/ui/tui/spokes/askvnc.py | 35 +++++++++++++++++++++--------------
> 1 file changed, 21 insertions(+), 14 deletions(-)
>
> diff --git a/pyanaconda/ui/tui/spokes/askvnc.py b/pyanaconda/ui/tui/spokes/askvnc.py
> index 200a5a6..52548f4 100644
> --- a/pyanaconda/ui/tui/spokes/askvnc.py
> +++ b/pyanaconda/ui/tui/spokes/askvnc.py
> @@ -21,9 +21,10 @@
>
> from pyanaconda.ui.tui.spokes import NormalTUISpoke
> from pyanaconda.ui.tui.simpleline import TextWidget, ColumnWidget
> +from pyanaconda.ui.tui.tuiobject import YesNoDialog
> from pyanaconda.constants import USEVNC, USETEXT
> from pyanaconda.i18n import N_, _
> -import getpass
> +import getpass, subprocess
>
> class AskVNCSpoke(NormalTUISpoke):
> title = N_("VNC")
> @@ -68,22 +69,28 @@ class AskVNCSpoke(NormalTUISpoke):
> """Override input so that we can launch the VNC password spoke"""
>
> try:
> - number = int(key)
> - choice = self._choices[number -1]
> + choice = self._choices[int(key) - 1]
> + if choice == USETEXT:
> + self._usevnc = False
> + else:
> + self._usevnc = True
> + newspoke = VNCPassSpoke(self.app, self.data, self.storage,
> + self.payload, self.instclass)
> + self.app.switch_screen_modal(newspoke)
> +
> + self.apply()
> + self.close()
> + return None
> except (ValueError, KeyError, IndexError):
> - return key
> + pass
>
> - if choice == USETEXT:
> - self._usevnc = False
> + if key.lower() == _('q'):
> + d = YesNoDialog(self.app, _(self.app.quit_message))
> + self.app.switch_screen_modal(d)
> + if d.answer:
> + subprocess.Popen(["systemctl", "--no-wall", "reboot"])
Is there any reason for rebooting system directly instead of calling
sys.exit(1) and leaving it to the exit handler? The code above doesn't
respect the inst.nokill option, for example.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list