fix: Make subscription-manager RPM protected on RHEL#3697
fix: Make subscription-manager RPM protected on RHEL#3697jirihnidek wants to merge 1 commit intomainfrom
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds a DNF protected package configuration for subscription-manager and ensures it is installed and owned correctly on RHEL builds only. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The install step assumes
%{_sysconfdir}/dnf/protected.dalready exists; consider adding amkdir -p %{buildroot}%{_sysconfdir}/dnf/protected.dguarded by the same%ifto avoid install-time failures on systems where this directory is not present. - If this config is only meaningful when dnf is used, consider aligning the
%if 0%{?rhel}guards with the existing%if %{use_dnf}logic so that the protected package configuration is not installed on RHEL builds that don’t enable dnf.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The install step assumes `%{_sysconfdir}/dnf/protected.d` already exists; consider adding a `mkdir -p %{buildroot}%{_sysconfdir}/dnf/protected.d` guarded by the same `%if` to avoid install-time failures on systems where this directory is not present.
- If this config is only meaningful when dnf is used, consider aligning the `%if 0%{?rhel}` guards with the existing `%if %{use_dnf}` logic so that the protected package configuration is not installed on RHEL builds that don’t enable dnf.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
* Card ID: RHEL-7172 * The dnf has concept of protected RPM packages. All protected packages should have configuration files in /etc/dnf/protected.d/ directory. * Added simple configuration file containing subscription-manager * Modified .spec file to install this file only on RHEL Signed-off-by: Jiri Hnidek <[email protected]>
1ec1fc1 to
9bab559
Compare
|
How to test it: $ sudo dnf -y install <path_to_sub_man_rhel_build_from_this_PR>
$ sudo dnf remove subscription-managerThe dnf should not allow to remove subscription-manager from the system.
Related documentation: https://access.redhat.com/solutions/6621501 |
mjcr99
left a comment
There was a problem hiding this comment.
LGTM
Test custom build:
[vagrant@lv-rhel101 subscription-manager]$ sudo dnf install /tmp/tito/x86_64/*
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:43 ago on Thu Feb 19 08:43:06 2026.
Dependencies resolved.
===================================================================================
Package Arch Version Repository Size
===================================================================================
Installing:
libdnf-plugin-subscription-manager-debuginfo
x86_64 1.30.12-1.git.4.9bab559.el10 @commandline 65 k
python3-subscription-manager-rhsm-debuginfo
x86_64 1.30.12-1.git.4.9bab559.el10 @commandline 46 k
subscription-manager-debuginfo
x86_64 1.30.12-1.git.4.9bab559.el10 @commandline 50 k
subscription-manager-debugsource
x86_64 1.30.12-1.git.4.9bab559.el10 @commandline 53 k
subscription-manager-plugin-ostree
x86_64 1.30.12-1.git.4.9bab559.el10 @commandline 48 k
Upgrading:
libdnf-plugin-subscription-manager
x86_64 1.30.12-1.git.4.9bab559.el10 @commandline 43 k
python3-cloud-what x86_64 1.30.12-1.git.4.9bab559.el10 @commandline 69 k
python3-subscription-manager-rhsm
x86_64 1.30.12-1.git.4.9bab559.el10 @commandline 177 k
subscription-manager x86_64 1.30.12-1.git.4.9bab559.el10 @commandline 844 k
...
Upgraded:
libdnf-plugin-subscription-manager-1.30.12-1.git.4.9bab559.el10.x86_64
python3-cloud-what-1.30.12-1.git.4.9bab559.el10.x86_64
python3-subscription-manager-rhsm-1.30.12-1.git.4.9bab559.el10.x86_64
subscription-manager-1.30.12-1.git.4.9bab559.el10.x86_64
Installed:
libdnf-plugin-subscription-manager-debuginfo-1.30.12-1.git.4.9bab559.el10.x86_64
python3-subscription-manager-rhsm-debuginfo-1.30.12-1.git.4.9bab559.el10.x86_64
subscription-manager-debuginfo-1.30.12-1.git.4.9bab559.el10.x86_64
subscription-manager-debugsource-1.30.12-1.git.4.9bab559.el10.x86_64
subscription-manager-plugin-ostree-1.30.12-1.git.4.9bab559.el10.x86_64
Complete!After it, the package is not allowed to be removed:
[vagrant@lv-rhel101 subscription-manager]$ sudo dnf remove subscription-manager
Updating Subscription Management repositories.
Error:
Problem: The operation would result in removing the following protected packages: subscription-manager
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)And the newly added file in the SPEC file is correctly installed:
[vagrant@lv-rhel101 subscription-manager]$ ls /etc/dnf/protected.d/subscription-manager.conf
/etc/dnf/protected.d/subscription-manager.conf|
@jsefler It will be also possible to remove subscription-manager RPM, when you the $ sudo rm -f /etc/dnf/protected.d/subscription-manager.conf
$ sudo dnf remove subscription-manager |
/etc/dnf/protected.d/directory..specfile to install this file only on RHEL