summaryrefslogtreecommitdiff
path: root/src/op_mode/image_manager.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-10-21 13:33:37 -0500
committerJohn Estabrook <jestabro@vyos.io>2023-11-15 11:29:04 -0600
commit96b65e90fbfa1fe63d97929ac86fc910abb0caa9 (patch)
tree467b257caea8c6118dfef5eb3ac54c79b7712167 /src/op_mode/image_manager.py
parent8efab9ee8cdb0e65dddb9d3ba97de8ddcf3666dc (diff)
downloadvyos-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 'src/op_mode/image_manager.py')
-rwxr-xr-xsrc/op_mode/image_manager.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/op_mode/image_manager.py b/src/op_mode/image_manager.py
index 76fc4367f..725c40613 100755
--- a/src/op_mode/image_manager.py
+++ b/src/op_mode/image_manager.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright 2022 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2023 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This file is part of VyOS.
#
@@ -22,10 +22,11 @@ from pathlib import Path
from shutil import rmtree
from sys import exit
-from vyos.system import disk, grub, image
+from vyos.system import disk, grub, image, compat
from vyos.utils.io import ask_yes_no
+@compat.grub_cfg_update
def delete_image(image_name: str) -> None:
"""Remove installed image files and boot entry
@@ -57,6 +58,7 @@ def delete_image(image_name: str) -> None:
exit(f'Unable to remove the image "{image_name}": {err}')
+@compat.grub_cfg_update
def set_image(image_name: str) -> None:
"""Set default boot image
@@ -86,6 +88,7 @@ def set_image(image_name: str) -> None:
exit(f'Unable to set default image "{image_name}": {err}')
+@compat.grub_cfg_update
def rename_image(name_old: str, name_new: str) -> None:
"""Rename installed image