summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2025-09-22 20:47:14 +0200
committerChristian Breunig <christian@breunig.cc>2025-09-22 21:28:32 +0200
commit805b90a636c50d63f68dd2746738030de966565a (patch)
treeb32f205c498ca23bd155af26869b006bbb7598a5 /src
parent4778f24abc1cee10fb0613c1cfa267980484c608 (diff)
downloadvyos-1x-805b90a636c50d63f68dd2746738030de966565a.tar.gz
vyos-1x-805b90a636c50d63f68dd2746738030de966565a.zip
image: T7818: avoid error when skipping config migration
Fix "No such file or directory" error triggered during image upgrade when user opts not to migrate config. GRUB cmdline migration incorrectly attempts to access non-existent config in new image path.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/image_installer.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/op_mode/image_installer.py b/src/op_mode/image_installer.py
index d7be4e1ed..6dc2dc490 100755
--- a/src/op_mode/image_installer.py
+++ b/src/op_mode/image_installer.py
@@ -1135,11 +1135,12 @@ def add_image(image_path: str, vrf: str = None, username: str = '',
if set_as_default:
grub.set_default(image_name, root_dir)
- cmdline_options = get_cli_kernel_options(
- f'{target_config_dir}/config.boot')
- grub_util.update_kernel_cmdline_options(' '.join(cmdline_options),
- root_dir=root_dir,
- version=image_name)
+ if Path(f'{target_config_dir}/config.boot').exists():
+ cmdline_options = get_cli_kernel_options(
+ f'{target_config_dir}/config.boot')
+ grub_util.update_kernel_cmdline_options(' '.join(cmdline_options),
+ root_dir=root_dir,
+ version=image_name)
except OSError as e:
# if no space error, remove image dir and cleanup