[master][PATCH] If we cannot activate keyboard, at least populate the missing items (#1104541)

Martin Kolman mkolman at redhat.com
Wed Jun 4 14:56:05 UTC 2014


On Wed, 2014-06-04 at 16:32 +0200, Vratislav Podzimek wrote:
> When activating keyboard configuration, we populate missing keyboard
> configuration items. However, on image/directory installations, we cannot
> activate keyboard configuration, but many components of our UI rely on the
> keyboard configuration items being set.
> 
> Also update the docstring of the populate_missing_items method which has become
> slightly nicer with the commit 57837c4298b0e4436246c6a0606fe5a1a3c48a71.
> 
> Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> ---
>  anaconda               |  8 ++++++--
>  pyanaconda/keyboard.py | 10 +++++++---
>  2 files changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/anaconda b/anaconda
> index 9c14933..fb191c0 100755
> --- a/anaconda
> +++ b/anaconda
> @@ -1017,8 +1017,12 @@ if __name__ == "__main__":
>          if not ksdata.keyboard.keyboard:
>              ksdata.keyboard.keyboard = opts.keymap
>  
> -    if ksdata.keyboard.keyboard and can_touch_runtime_system("activate keyboard"):
> -        keyboard.activate_keyboard(ksdata.keyboard)
> +    if ksdata.keyboard.keyboard:
> +        if can_touch_runtime_system("activate keyboard"):
> +            keyboard.activate_keyboard(ksdata.keyboard)
> +        else:
> +            # at least make sure we have all the values
> +            keyboard.populate_missing_items(ksdata.keyboard)
>  
>      # Some post-install parts of anaconda are implemented as kickstart
>      # scripts.  Add those to the ksdata now.
> diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py
> index c694c57..083f823 100644
> --- a/pyanaconda/keyboard.py
> +++ b/pyanaconda/keyboard.py
> @@ -138,9 +138,9 @@ def normalize_layout_variant(layout_str):
>  
>  def populate_missing_items(keyboard):
>      """
> -    Function that populates keyboard.vc_keymap and keyboard.x_layouts if
> -    they are missing. By invoking LocaledWrapper's methods this function
> -    MODIFIES CONFIGURATION FILES.
> +    Function that populates keyboard.vc_keymap and keyboard.x_layouts if they
> +    are missing. By invoking LocaledWrapper's methods this function READS AND
> +    WRITES CONFIGURATION FILES (but tries to keep their content unchanged).
>  
>      :type keyboard: ksdata.keyboard object
>  
> @@ -148,6 +148,10 @@ def populate_missing_items(keyboard):
>  
>      localed = LocaledWrapper()
>  
> +    if keyboard._keyboard and not (keyboard.vc_keymap or keyboard.x_layouts):
> +        # just the value in old format given, use it as a vc_keymap
                ^ I think there might be missing something there as I
                  can't really make sede of what it means :)
> +        keyboard.vc_keymap = keyboard._keyboard
> +
>      if keyboard.x_layouts and not keyboard.vc_keymap:
>          keyboard.vc_keymap = localed.convert_layout(keyboard.x_layouts[0])
>  
Other than that one nitpick looks good, so ACK! :)



More information about the anaconda-patches mailing list