-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RHELC-1329] Port pkghandler.preserve_only_rhel_kernel() to Action framework #1250
[RHELC-1329] Port pkghandler.preserve_only_rhel_kernel() to Action framework #1250
Conversation
@r0x0d will add the tests after we confirm that this structure is okay for the port |
) | ||
|
||
|
||
class FixInvalidGrub2Entries(actions.Action): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks to me that it should probably belongs to a grub.py module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True I could see it as apart of the grub refactor we were going to do - seems important to preserving the rhel kernel though
convert2rhel/unit_tests/actions/conversion/preserve_only_rhel_kernel_test.py
Fixed
Show resolved
Hide resolved
convert2rhel/unit_tests/actions/conversion/preserve_only_rhel_kernel_test.py
Fixed
Show resolved
Hide resolved
convert2rhel/unit_tests/actions/conversion/preserve_only_rhel_kernel_test.py
Fixed
Show resolved
Hide resolved
convert2rhel/unit_tests/actions/conversion/preserve_only_rhel_kernel_test.py
Fixed
Show fixed
Hide fixed
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1250 +/- ##
==========================================
+ Coverage 95.92% 96.13% +0.21%
==========================================
Files 56 57 +1
Lines 4784 4818 +34
Branches 750 846 +96
==========================================
+ Hits 4589 4632 +43
+ Misses 111 107 -4
+ Partials 84 79 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
convert2rhel/unit_tests/actions/conversion/preserve_only_rhel_kernel_test.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small comments, otherwise looks good!
58929f5
to
e30a880
Compare
convert2rhel/unit_tests/actions/conversion/preserve_only_rhel_kernel_test.py
Outdated
Show resolved
Hide resolved
convert2rhel/unit_tests/actions/conversion/preserve_only_rhel_kernel_test.py
Outdated
Show resolved
Hide resolved
convert2rhel/unit_tests/actions/conversion/preserve_only_rhel_kernel_test.py
Outdated
Show resolved
Hide resolved
/packit build |
convert2rhel/unit_tests/actions/conversion/preserve_only_rhel_kernel_test.py
Outdated
Show resolved
Hide resolved
convert2rhel/unit_tests/actions/conversion/preserve_only_rhel_kernel_test.py
Show resolved
Hide resolved
convert2rhel/unit_tests/actions/conversion/preserve_only_rhel_kernel_test.py
Show resolved
Hide resolved
/packit build |
already_installed = re.search(r" (.*?)(?: is)? already installed", output, re.MULTILINE) | ||
if already_installed: | ||
rhel_kernel_nevra = already_installed.group(1) | ||
non_rhel_kernels = pkghandler.get_installed_pkgs_w_different_fingerprint( | ||
system_info.fingerprints_rhel, "kernel" | ||
) | ||
for non_rhel_kernel in non_rhel_kernels: | ||
# We're comparing to NEVRA since that's what yum/dnf prints out | ||
if rhel_kernel_nevra == pkghandler.get_pkg_nevra(non_rhel_kernel): | ||
# If the installed kernel is from a third party (non-RHEL) and has the same NEVRA as the one available | ||
# from RHEL repos, it's necessary to install an older version RHEL kernel and the third party one will | ||
# be removed later in the conversion process. It's because yum/dnf is unable to reinstall a kernel. | ||
info_message = ( | ||
"Conflict of kernels: One of the installed kernels" | ||
" has the same version as the latest RHEL kernel." | ||
) | ||
loggerinst.info("\n%s" % info_message) | ||
self.add_message( | ||
level="INFO", | ||
id="CONFLICT_OF_KERNELS", | ||
title="Conflict of installed kernel versions", | ||
description=info_message, | ||
) | ||
pkghandler.handle_no_newer_rhel_kernel_available() | ||
kernel_update_needed = True | ||
|
||
if kernel_update_needed: | ||
pkghandler.update_rhel_kernel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a discussion tomorrow about this code, and if we decide that @danmyway solution is the way to go, then I think we can incorporate his changes here: https://github.com/oamg/convert2rhel/pull/1323/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
/packit test --labels sanity |
tests passed and one waived. code looks good and we can iterate on next PRs if needed.
Co-authored-by: Rodolfo Olivieri <[email protected]>
Co-authored-by: Rodolfo Olivieri <[email protected]>
Co-authored-by: Rodolfo Olivieri <[email protected]>
for more information, see https://pre-commit.ci
Co-authored-by: Rodolfo Olivieri <[email protected]>
59566b8
to
d39ebc4
Compare
…amework (oamg#1250) * [RHELC-1329] Port pkghandler.preserve_only_rhel_kernel() to Action framework * Apply suggestions from code review Co-authored-by: Rodolfo Olivieri <[email protected]> * Code review suggestions * Unit tests * Updated unit tests * Apply suggestions from code review Co-authored-by: Rodolfo Olivieri <[email protected]> * Update title * Fix unit tests * Apply suggestions from code review Co-authored-by: Rodolfo Olivieri <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix unit tests * Remove preserve_only_rhel_kernel call from main * Apply suggestions from code review Co-authored-by: Rodolfo Olivieri <[email protected]> * Update RHEL_KERNEL_INSTALLED info block * Update info log for kernel install * Fix unit tests * Add unit test for invalid grub2 entries --------- Co-authored-by: Rodolfo Olivieri <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This PR ports the function preserve_only_rhel_kernel to the action framework. Changing any relevant logger crictical, warning and info messages to Error results and Warning and Info messages respectively.
Jira Issues:
Checklist
[RHELC-]
is part of the PR titleRelease Pending
if relevant