Subject: virtinst: ignore comments in keymap conf files From: Jim Fehlig jfehlig@suse.com Wed Oct 11 15:13:26 2017 -0600 Date: Wed Oct 18 17:46:41 2017 -0400: Git: 9a9f9ecd2c1f03665809009ad6cfde937b09adaa 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 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. diff --git a/virtinst/hostkeymap.py b/virtinst/hostkeymap.py index 71503730..87a80ef6 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