From 176bce88d3862b56e99b10ccf557dd4503bcc0bc Mon Sep 17 00:00:00 2001 From: zsdc Date: Fri, 15 Dec 2023 13:43:30 +0200 Subject: vyos_install: T5220: Fixed unbound variables Fixed logic in `grub_configure()` to avoid unbound variables. --- cloudinit/config/cc_vyos_install.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cloudinit/config/cc_vyos_install.py b/cloudinit/config/cc_vyos_install.py index 2c3629f8..7ca663ee 100644 --- a/cloudinit/config/cc_vyos_install.py +++ b/cloudinit/config/cc_vyos_install.py @@ -246,12 +246,15 @@ def grub_configure(grub_dir: str, vyos_version: str, vyos_version (str): VyOS version id boot_params (dict[str, str]): boot parameters """ - if boot_params['console_type'] == 'kvm': - default_boot = 0 - elif boot_params['console_type'] == 'serial': + if boot_params['console_type'] == 'serial': default_boot = 1 + else: + default_boot = 0 + if boot_params['cmdline_extra']: cmdline_extra = f' {boot_params["cmdline_extra"]}' + else: + cmdline_extra = '' grub_cfg_content: str = dedent(f''' # load EFI video modules if [ "${{grub_platform}}" == "efi" ]; then -- cgit v1.2.3