diff options
author | John Estabrook <jestabro@vyos.io> | 2024-01-25 15:07:53 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-25 15:07:53 -0600 |
commit | f97225161941591033aa9216bb2335280522d10d (patch) | |
tree | e1f45646bc6bb9fdf1b5fa05a25b2dac4f2309e8 /python/vyos | |
parent | bda7df42d2d7bcdb1c00610a9bfc02c22cd9a3d1 (diff) | |
parent | ea6b6db9d52ec4c5383eb99eb2f9f258d8d0d04f (diff) | |
download | vyos-1x-f97225161941591033aa9216bb2335280522d10d.tar.gz vyos-1x-f97225161941591033aa9216bb2335280522d10d.zip |
Merge pull request #2896 from vyos/mergify/bp/sagitta/pr-2893
image-tools: T5983: fix regression in prune_vyos_versions (backport #2893)
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/system/compat.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/python/vyos/system/compat.py b/python/vyos/system/compat.py index 436da14e8..cc0529b91 100644 --- a/python/vyos/system/compat.py +++ b/python/vyos/system/compat.py @@ -170,9 +170,12 @@ def prune_vyos_versions(root_dir: str = '') -> None: if not root_dir: root_dir = disk.find_persistence() - for version in grub.version_list(): + version_files = Path(f'{root_dir}/{grub.GRUB_DIR_VYOS_VERS}').glob('*.cfg') + + for file in version_files: + version = Path(file).stem if not Path(f'{root_dir}/boot/{version}').is_dir(): - grub.version_del(version) + grub.version_del(version, root_dir) def update_cfg_ver(root_dir:str = '') -> int: |