Update ELevate patch

This commit is contained in:
Andrew Lukoshko 2023-08-23 13:02:02 +02:00
parent 0c12ecfb26
commit 57850abeac
2 changed files with 58 additions and 3 deletions

View File

@ -4654,10 +4654,37 @@ index edf978f6..7fea4ece 100644
variant_id=data.get('VARIANT_ID', '').strip('"') or None
)
diff --git a/repos/system_upgrade/common/actors/kernel/checkinstalledkernels/libraries/checkinstalledkernels.py b/repos/system_upgrade/common/actors/kernel/checkinstalledkernels/libraries/checkinstalledkernels.py
index 134d1aad..c4d99317 100644
index 134d1aad..2b4dd5ce 100644
--- a/repos/system_upgrade/common/actors/kernel/checkinstalledkernels/libraries/checkinstalledkernels.py
+++ b/repos/system_upgrade/common/actors/kernel/checkinstalledkernels/libraries/checkinstalledkernels.py
@@ -125,7 +125,12 @@ def process():
@@ -87,12 +87,23 @@ def get_newest_evr(pkgs):
return newest_evr
-def process():
- kernel_name = 'kernel'
+def _get_kernel_rpm_name():
+ base_name = 'kernel'
if version.is_rhel_realtime():
api.current_logger().info('The Real Time kernel boot detected.')
- kernel_name = 'kernel-rt'
+ base_name = 'kernel-rt'
+
+ if version.get_source_major_version() == '7':
+ return base_name
+
+ # Since RHEL 8, the kernel|kernel-rt rpm is just a metapackage that even
+ # does not have to be installed on the system.
+ # The kernel-core|kernel-rt-core rpm is the one we care about instead.
+ return '{}-core'.format(base_name)
+
+def process():
+ kernel_name = _get_kernel_rpm_name()
pkgs = get_pkgs(kernel_name)
if not pkgs:
# Hypothatical, user is not allowed to install any kernel that is not signed by RH
@@ -125,7 +136,12 @@ def process():
api.current_logger().debug('Current kernel EVR: {}'.format(current_evr))
api.current_logger().debug('Newest kernel EVR: {}'.format(newest_evr))
@ -4671,6 +4698,34 @@ index 134d1aad..c4d99317 100644
title = 'Newest installed kernel not in use'
summary = ('To ensure a stable upgrade, the machine needs to be'
' booted into the latest installed kernel.')
diff --git a/repos/system_upgrade/common/actors/kernel/checkinstalledkernels/tests/unit_test_checkinstalledkernels.py b/repos/system_upgrade/common/actors/kernel/checkinstalledkernels/tests/unit_test_checkinstalledkernels.py
index c759600a..3f42cb2e 100644
--- a/repos/system_upgrade/common/actors/kernel/checkinstalledkernels/tests/unit_test_checkinstalledkernels.py
+++ b/repos/system_upgrade/common/actors/kernel/checkinstalledkernels/tests/unit_test_checkinstalledkernels.py
@@ -5,7 +5,7 @@ from leapp.libraries.actor import checkinstalledkernels
from leapp.libraries.common.config import architecture
from leapp.libraries.common.testutils import create_report_mocked, CurrentActorMocked, logger_mocked
from leapp.libraries.stdlib import api
-from leapp.models import RPM, InstalledRedHatSignedRPM
+from leapp.models import InstalledRedHatSignedRPM, RPM
RH_PACKAGER = 'Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>'
@@ -206,3 +206,14 @@ def test_newest_kernel_realtime(monkeypatch, expect_report, msgs, curr_kernel):
assert reporting.create_report.report_fields['title'] == 'Newest installed kernel not in use'
else:
assert not reporting.create_report.called
+
+
+@pytest.mark.parametrize('current_actor_mocked,expected_name', [
+ (CurrentActorMocked(kernel='3.10.0-957.43.1.el7.x86_64', src_ver='7.9'), 'kernel'),
+ (CurrentActorMocked(kernel='3.10.0-789.35.2.rt56.1133.el7.x86_64', src_ver='7.9'), 'kernel-rt'),
+ (CurrentActorMocked(kernel='4.14.0-115.29.1.el7.x86_64', src_ver='8.6'), 'kernel-core'),
+ (CurrentActorMocked(kernel='4.14.0-789.35.2.rt56.1133.el8.x86_64', src_ver='8.6'), 'kernel-rt-core'),
+])
+def test_kernel_name(monkeypatch, current_actor_mocked, expected_name):
+ monkeypatch.setattr(api, 'current_actor', current_actor_mocked)
+ assert expected_name == checkinstalledkernels._get_kernel_rpm_name()
diff --git a/repos/system_upgrade/common/actors/pcidevicesscanner/libraries/pcidevicesscanner.py b/repos/system_upgrade/common/actors/pcidevicesscanner/libraries/pcidevicesscanner.py
index 146f1a33..eb063abb 100644
--- a/repos/system_upgrade/common/actors/pcidevicesscanner/libraries/pcidevicesscanner.py

View File

@ -43,7 +43,7 @@ py2_byte_compile "%1" "%2"}
Epoch: 1
Name: leapp-repository
Version: 0.16.0
Release: 6%{?dist}.elevate.15
Release: 6%{?dist}.elevate.16
Summary: Repositories for leapp
License: ASL 2.0