diff options
| author | Christian Breunig <christian@breunig.cc> | 2025-09-22 20:47:14 +0200 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2025-09-22 21:28:32 +0200 |
| commit | 805b90a636c50d63f68dd2746738030de966565a (patch) | |
| tree | b32f205c498ca23bd155af26869b006bbb7598a5 /src | |
| parent | 4778f24abc1cee10fb0613c1cfa267980484c608 (diff) | |
| download | vyos-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-x | src/op_mode/image_installer.py | 11 |
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 |
