From 94c9f432b59cbb57845db03583d357a0677412f4 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Thu, 31 Jul 2025 16:48:00 +0200 Subject: T7668: bail out early in get_cli_kernel_options() if nothing is to do If there is no Kernel option to pass, there is no need to run the code to completion. Bail out early. --- src/op_mode/image_installer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/op_mode/image_installer.py b/src/op_mode/image_installer.py index 2a9830f37..e42d5b856 100755 --- a/src/op_mode/image_installer.py +++ b/src/op_mode/image_installer.py @@ -493,12 +493,13 @@ def setup_grub(root_dir: str) -> None: def get_cli_kernel_options(config_file: str) -> list: config = ConfigTree(read_file(config_file)) config_dict = loads(config.to_json()) + cmdline_options = [] kernel_options = dict_search('system.option.kernel', config_dict) if kernel_options is None: - kernel_options = {} + return cmdline_options + k_cpu_opts = kernel_options.get('cpu', {}) k_memory_opts = kernel_options.get('memory', {}) - cmdline_options = [] # XXX: This code path and if statements must be kept in sync with the Kernel # option handling in system_options.py:generate(). This occurance is used -- cgit v1.2.3