summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsdc <taras@vyos.io>2023-12-15 13:43:30 +0200
committerzsdc <taras@vyos.io>2023-12-15 13:43:30 +0200
commit176bce88d3862b56e99b10ccf557dd4503bcc0bc (patch)
treea1b4a4ec3c2619f5cd4aabc08bcae0db06f85591
parentbddcb7cd52966c4852e40b8dc8f253303b877b04 (diff)
downloadvyos-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.py9
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