Add new config module to set keyboard layout#1176
Conversation
Adds a new module to allow setting keyboard layout, for use-cases in which cloud-init is used to configure OS images meant for physical computers instead of the cloud. This initial release only implements support for Linux distributions that allow layout to be set through systemd's localectl. Closes https://bugs.launchpad.net/cloud-init/+bug/1951593
- Add keyboard module to modules.rst - Add comments to examples
TheRealFalcon
left a comment
There was a problem hiding this comment.
Thanks for the very thorough PR!
Code looks good. Can we add a few small docs changes?
diff --git a/cloudinit/config/cc_keyboard.py b/cloudinit/config/cc_keyboard.py
index e9165e06c..626ce812e 100644
--- a/cloudinit/config/cc_keyboard.py
+++ b/cloudinit/config/cc_keyboard.py
@@ -25,7 +25,7 @@ DEFAULT_KEYBOARD_MODEL = "pc105"
meta = {
"id": "cc_keyboard",
"name": "Keyboard",
- "title": "set keyboard layout",
+ "title": "Set keyboard layout",
"description": dedent(
"""\
Handle keyboard configuration.
@@ -65,7 +65,7 @@ schema = {
"type": "string",
"description": dedent(
"""\
- Keyboard layout. Corresponds to XKBLAYOUT.
+ Required. Keyboard layout. Corresponds to XKBLAYOUT.
"""
),
},
@@ -74,7 +74,7 @@ schema = {
"default": DEFAULT_KEYBOARD_MODEL,
"description": dedent(
"""\
- Keyboard model. Corresponds to XKBMODEL.
+ Optional. Keyboard model. Corresponds to XKBMODEL.
"""
),
},
@@ -82,7 +82,7 @@ schema = {
"type": "string",
"description": dedent(
"""\
- Keyboard variant. Corresponds to XKBVARIANT.
+ Optional. Keyboard variant. Corresponds to XKBVARIANT.
"""
),
},
@@ -90,7 +90,7 @@ schema = {
"type": "string",
"description": dedent(
"""\
- Keyboard options. Corresponds to XKBOPTIONS.
+ Optional. Keyboard options. Corresponds to XKBOPTIONS.
"""
),
},Other than that, looks good to me!
|
Thanks for the review. Added the doc changes. |
|
Hi everyone! I'am use autoinstall Ubuntu desktop. How I can add 2 keyboard layouts into installed OC? P.S. Sorry, if I'm writing in the wrong place. |
|
Hi, @Sistem-Pack. cloud-init.keyboard nor subiquity/autoinstall.keyboard modules have the ability to configure more than one keyboard. Note that late-commands run in the installer environment, not in the target system. (If you want to understand more about the difference between the installation environment and how are subiquity/autoinstall and cloud-init related, see Interactions between autoinstall and cloud-init). To run your commands in the target environment, do: #cloud-config
autoinstall:
version: 1
...
user-data:
runcmd:
- [settings, set org.gnome.desktop.input-sources, sources, "\"[('xkb', 'us'), ('xkb', 'fr')]\""]For more dynamic questions/support, you can contact IRC channels at Libera Chat: Or if you believe there is an issue / missing feature, create a ticket in https://bugs.launchpad.net/subiquity or https://github.com/canonical/cloud-init/issues. Thanks! |
Proposed Commit Message
Test Steps
Allow setting keyboard layout like this:
Or if you need more specific options:
Checklist: