]> git.ipfire.org Git - people/ms/bricklayer.git/commitdiff
keymaps: Refactor how we ignore any errors
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 25 Feb 2023 12:16:42 +0000 (12:16 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 25 Feb 2023 12:16:42 +0000 (12:16 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/keymaps.py

index 13950dbb18466118121bc3a8aaa4f82560536439..aec7da5c599b9b4fe2560b9b2011404adefae2e5 100644 (file)
@@ -19,7 +19,6 @@
 ###############################################################################
 
 import logging
-import subprocess
 
 from . import step
 from .i18n import _
@@ -32,16 +31,15 @@ class SelectKeymap(step.InteractiveStep):
 
        def run(self):
                # Get a list of all available keymaps
-               try:
-                       keymaps = self.bricklayer.command(["localectl", "list-keymaps"])
+               keymaps = self.bricklayer.command(["localectl", "list-keymaps"], error_ok=True)
 
-                       # Split the output by line
-                       keymaps = { km : km for km in keymaps.splitlines() }
-
-               # Silently skip this step if no keymaps could be loaded
-               except subprocess.CalledProcessError:
+               # Skip this step if no keymaps could be loaded
+               if not keymaps:
                        return
 
+               # Split the output by line
+               keymaps = { km : km for km in keymaps.splitlines() }
+
                # Which keymap is currently selected?
                keymap = self.bricklayer.settings.get("keymap")