diff options
author | Daniil Baturin <daniil@vyos.io> | 2024-01-25 09:07:30 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-25 09:07:30 +0000 |
commit | 80d6813cad2451c95e809717a5e8d9264d483041 (patch) | |
tree | 73b2c3ad791cfd779ce7cc8a00bec8a274fc1061 | |
parent | d736a9b70ca897bdf1e0237b64ab5c7eb958b520 (diff) | |
parent | d603b1e3b2d0edb5a996b687236c12b50ad60259 (diff) | |
download | vyos-1x-80d6813cad2451c95e809717a5e8d9264d483041.tar.gz vyos-1x-80d6813cad2451c95e809717a5e8d9264d483041.zip |
Merge pull request #2893 from jestabro/fix-regression-version-files
image-tools: T5983: fix regression in prune_vyos_versions
-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 626ce0067..37b834ad6 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: |