diff options
author | John Estabrook <jestabro@vyos.io> | 2023-10-21 13:33:37 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2023-11-15 11:29:04 -0600 |
commit | 96b65e90fbfa1fe63d97929ac86fc910abb0caa9 (patch) | |
tree | 467b257caea8c6118dfef5eb3ac54c79b7712167 /python/vyos/system/grub.py | |
parent | 8efab9ee8cdb0e65dddb9d3ba97de8ddcf3666dc (diff) | |
download | vyos-1x-96b65e90fbfa1fe63d97929ac86fc910abb0caa9.tar.gz vyos-1x-96b65e90fbfa1fe63d97929ac86fc910abb0caa9.zip |
image: T4516: support for interoperability of legacy/new image tools
This commit allows management of system images with either new or legacy
tools: 'add/delete/rename system image' and 'set default' are translated
appropriately on booting between images with the old and new tools.
Consequently, the warning of the initial commit of T4516 is dropped.
Diffstat (limited to 'python/vyos/system/grub.py')
-rw-r--r-- | python/vyos/system/grub.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/python/vyos/system/grub.py b/python/vyos/system/grub.py index 47c674de8..9ac205c03 100644 --- a/python/vyos/system/grub.py +++ b/python/vyos/system/grub.py @@ -1,4 +1,4 @@ -# Copyright 2022 VyOS maintainers and contributors <maintainers@vyos.io> +# Copyright 2023 VyOS maintainers and contributors <maintainers@vyos.io> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -24,6 +24,7 @@ from vyos.system import disk # Define variables GRUB_DIR_MAIN: str = '/boot/grub' +GRUB_CFG_MAIN: str = f'{GRUB_DIR_MAIN}/grub.cfg' GRUB_DIR_VYOS: str = f'{GRUB_DIR_MAIN}/grub.cfg.d' CFG_VYOS_HEADER: str = f'{GRUB_DIR_VYOS}/00-vyos-header.cfg' CFG_VYOS_MODULES: str = f'{GRUB_DIR_VYOS}/10-vyos-modules-autoload.cfg' @@ -181,8 +182,8 @@ def get_cfg_ver(root_dir: str = '') -> int: if not root_dir: root_dir = disk.find_persistence() - cfg_ver: Union[str, None] = vars_read(f'{root_dir}/{CFG_VYOS_HEADER}').get( - 'VYOS_CFG_VER') + cfg_ver: str = vars_read(f'{root_dir}/{CFG_VYOS_HEADER}').get( + 'VYOS_CFG_VER') if cfg_ver: cfg_ver_int: int = int(cfg_ver) else: |