leapp-repository/0071-refactor-distributionsignedrpmscanner-to-use-common-.patch
Toshio Kuratomi d9029cec24 CTC2 candidate 1 (Release for 8.10/9.5)
- Improve set_systemd_services_states logging
- [IPU 7 -> 8] Fix detection of bootable device on RAID
- Fix detection of valid sshd config with internal-sftp subsystem in Leapp
- Handle a false positive GPG check error when TargetUserSpaceInfo is missing
- Fix failing "update-ca-trust" command caused by missing util-linux package
- Improve report when a system is unsupported
- Fix handling of versions in RHUI configuration for ELS and SAP upgrades
- Add missing RHUI GCP config info for RHEL for SAP

- Resolves: RHEL-33902, RHEL-30573, RHEL-43978, RHEL-39046, RHEL-39047, RHEL-39049
2024-07-25 00:55:43 -07:00

57 lines
2.4 KiB
Diff

From f822cb805ed9efd101fd212eb162544ab29c8fe9 Mon Sep 17 00:00:00 2001
From: Evgeni Golov <evgeni@golov.de>
Date: Mon, 27 May 2024 11:58:46 +0200
Subject: [PATCH 71/92] refactor distributionsignedrpmscanner to use common
distro helper
---
.../libraries/distributionsignedrpmscanner.py | 22 ++-----------------
1 file changed, 2 insertions(+), 20 deletions(-)
diff --git a/repos/system_upgrade/common/actors/distributionsignedrpmscanner/libraries/distributionsignedrpmscanner.py b/repos/system_upgrade/common/actors/distributionsignedrpmscanner/libraries/distributionsignedrpmscanner.py
index 7898453b..51d6eeb5 100644
--- a/repos/system_upgrade/common/actors/distributionsignedrpmscanner/libraries/distributionsignedrpmscanner.py
+++ b/repos/system_upgrade/common/actors/distributionsignedrpmscanner/libraries/distributionsignedrpmscanner.py
@@ -1,28 +1,10 @@
-import json
-import os
-
-from leapp.exceptions import StopActorExecutionError
from leapp.libraries.common import rhui
from leapp.libraries.common.config import get_env
+from leapp.libraries.common.distro import get_distribution_data
from leapp.libraries.stdlib import api
from leapp.models import DistributionSignedRPM, InstalledRedHatSignedRPM, InstalledRPM, InstalledUnsignedRPM
-def get_distribution_data(distribution):
- distributions_path = api.get_common_folder_path('distro')
-
- distribution_config = os.path.join(distributions_path, distribution, 'gpg-signatures.json')
- if os.path.exists(distribution_config):
- with open(distribution_config) as distro_config_file:
- distro_config_json = json.load(distro_config_file)
- distro_keys = distro_config_json.get('keys', [])
- else:
- raise StopActorExecutionError(
- 'Cannot find distribution signature configuration.',
- details={'Problem': 'Distribution {} was not found in {}.'.format(distribution, distributions_path)})
- return distro_keys
-
-
def is_distro_signed(pkg, distro_keys):
return any(key in pkg.pgpsig for key in distro_keys)
@@ -49,7 +31,7 @@ def is_exceptional(pkg, allowlist):
def process():
distribution = api.current_actor().configuration.os_release.release_id
- distro_keys = get_distribution_data(distribution)
+ distro_keys = get_distribution_data(distribution).get('keys', [])
all_signed = get_env('LEAPP_DEVEL_RPMS_ALL_SIGNED', '0') == '1'
rhui_pkgs = rhui.get_all_known_rhui_pkgs_for_current_upg()
--
2.42.0