Re: [PATCH] virtinst: ignore comments in keymap conf files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/11/2017 05:13 PM, Jim Fehlig wrote:
> On a host system with keyboard configured to en-US, it was noticed
> that virt-install created install XML with keymap='de'. The host
> system did not have /etc/vconsole.conf, so /etc/sysconfig/keyboard
> was the next file to check, which contained the following
> 
> # Path:        Hardware/Keyboard
> ## Description: Keyboard settings
> ## Type:        string
> ## Default:     ""
> ## ServiceRestart: kbd
> #
> # Keyboard settings for the text console
> #
> # Keyboard mapping
> # (/usr/share/kbd/keymaps/)
> # e.g. KEYTABLE="de-latin1-nodeadkeys", "us" or empty for US settings
> #
> KEYTABLE=""
> 
> Currently the parsing code does not ignore comments and incorrectly
> parsed a 'de' keymap. Fix by ignoring any lines that start with '#'
> after trimming whitespace.
> ---
>  virtinst/hostkeymap.py | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/virtinst/hostkeymap.py b/virtinst/hostkeymap.py
> index 71503730..562d0f99 100644
> --- a/virtinst/hostkeymap.py
> +++ b/virtinst/hostkeymap.py
> @@ -71,6 +71,9 @@ def _sysconfig_keyboard(f):
>          s = f.readline()
>          if s == "":
>              break
> +        s = s.strip()
> +        if (s.startswith("#")):
> +            continue
>          if (re.search("KEYMAP", s) is not None or
>              re.search("KEYTABLE", s) is not None or
>             (re.search("KEYBOARD", s) is not None and
> 

Thanks, pushed now with the redundant parentheses dropped, and a test
suite tweak

- Cole

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux