From 7e0fb44bb673893d0409903f6a441d0eb2829d22 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Tue, 20 Aug 2024 15:11:02 +0200 Subject: [PATCH 02/40] don't require all versions to be defined for obsoleted keys in releases where we do not have any obsoleted keys, we still had to define an entry (with an empty list), as otherwise the code would fail instead, we can catch the KeyError and carry on as nothing happened --- .../libraries/removeobsoleterpmgpgkeys.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/repos/system_upgrade/common/actors/removeobsoletegpgkeys/libraries/removeobsoleterpmgpgkeys.py b/repos/system_upgrade/common/actors/removeobsoletegpgkeys/libraries/removeobsoleterpmgpgkeys.py index 6e84c2e9..bda7efa3 100644 --- a/repos/system_upgrade/common/actors/removeobsoletegpgkeys/libraries/removeobsoleterpmgpgkeys.py +++ b/repos/system_upgrade/common/actors/removeobsoletegpgkeys/libraries/removeobsoleterpmgpgkeys.py @@ -12,11 +12,14 @@ def _get_obsolete_keys(): distribution = api.current_actor().configuration.os_release.release_id obsoleted_keys_map = get_distribution_data(distribution).get('obsoleted-keys', {}) keys = [] - for version in range(7, int(get_target_major_version()) + 1): - for key in obsoleted_keys_map[str(version)]: - name, version, release = key.rsplit("-", 2) - if has_package(InstalledRPM, name, version=version, release=release): - keys.append(key) + try: + for version in range(7, int(get_target_major_version()) + 1): + for key in obsoleted_keys_map[str(version)]: + name, version, release = key.rsplit("-", 2) + if has_package(InstalledRPM, name, version=version, release=release): + keys.append(key) + except KeyError: + pass return keys -- 2.47.0