diff options
author | zsdc <taras@vyos.io> | 2023-12-15 13:43:30 +0200 |
---|---|---|
committer | zsdc <taras@vyos.io> | 2023-12-15 13:43:30 +0200 |
commit | 176bce88d3862b56e99b10ccf557dd4503bcc0bc (patch) | |
tree | a1b4a4ec3c2619f5cd4aabc08bcae0db06f85591 | |
parent | bddcb7cd52966c4852e40b8dc8f253303b877b04 (diff) | |
download | vyos-cloud-init-176bce88d3862b56e99b10ccf557dd4503bcc0bc.tar.gz vyos-cloud-init-176bce88d3862b56e99b10ccf557dd4503bcc0bc.zip |
vyos_install: T5220: Fixed unbound variables
Fixed logic in `grub_configure()` to avoid unbound variables.
-rw-r--r-- | cloudinit/config/cc_vyos_install.py | 9 |
1 files 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 |