Skip to content
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-601] Install subscription-manager using package manager #1164

Merged
merged 7 commits into from
May 21, 2024

Conversation

r0x0d
Copy link
Member

@r0x0d r0x0d commented Apr 1, 2024

In this commit, we are introducing the installation of subscription-manager directly through a package manager, instead of downloading the package first and then installing it with system package manager.

This is necessary as we want to do GPG verification when installing those set of packages, in which case, it was not available when we used to download the packages and then install it via local install.

Notable changes in this commit are:

  • Replacing installing subscription-manager to install it directly from the client-tools repository with gpg check enabled for all supported versions
  • Minor refactor to RestorablePackageSet class to allow it to be generic and use custom repository paths and content to install packages
  • Small tweak to call_yum_cmd to use the reposdir option as a list instead of a string
  • Move subscription-manager constants to subscription.py module instead of the packages.py backup module

Jira Issues: RHELC-601

Checklist

  • PR has been tested manually in a VM (either author or reviewer)
  • Jira issue has been made public if possible
  • [RHELC-] is part of the PR title
  • GitHub label has been added to help with Release notes
  • PR title explains the change from the user's point of view
  • Code and tests are documented properly
  • The commits are squashed to as few commits as possible (without losing data)
  • When merged: Jira issue has been updated to Release Pending if relevant

Depends on

Copy link

codecov bot commented Apr 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.53%. Comparing base (6972848) to head (2835f9f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1164      +/-   ##
==========================================
+ Coverage   95.44%   95.53%   +0.08%     
==========================================
  Files          54       54              
  Lines        4723     4705      -18     
  Branches      834      827       -7     
==========================================
- Hits         4508     4495      -13     
+ Misses        132      127       -5     
  Partials       83       83              
Flag Coverage Δ
centos-linux-7 90.66% <100.00%> (+0.07%) ⬆️
centos-linux-8 91.61% <100.00%> (+0.07%) ⬆️
centos-linux-9 91.66% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@r0x0d r0x0d added enhancement New feature or request tests-run-tier0 PR ready to run the essential test suit. Equivalent to `/packit test --labels tier0`. labels Apr 1, 2024
@has-bot
Copy link
Member

has-bot commented Apr 1, 2024

/packit test --labels tier0


Comment generated by an automation.

@r0x0d r0x0d force-pushed the install-sub-man-through-yum branch 3 times, most recently from 42e99a5 to a793dfd Compare April 1, 2024 18:26
@r0x0d
Copy link
Member Author

r0x0d commented Apr 2, 2024

/packit test --labels tier0

@Venefilyn
Copy link
Member

/packit build

Copy link
Member

@Venefilyn Venefilyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code seems good to me, just need to get integration tests passing. Here's hoping for a flawless test run 🤞

convert2rhel/subscription.py Outdated Show resolved Hide resolved
convert2rhel/subscription.py Outdated Show resolved Hide resolved
@r0x0d r0x0d force-pushed the install-sub-man-through-yum branch 2 times, most recently from a217166 to 440b96f Compare April 4, 2024 13:54
@r0x0d

This comment was marked as off-topic.

@Venefilyn
Copy link
Member

Due to the nature of the change I want to wait for Satellite and offline integration tests to run successfully beforehand

@r0x0d r0x0d force-pushed the install-sub-man-through-yum branch from 440b96f to 421739b Compare April 8, 2024 14:18
@r0x0d

This comment was marked as outdated.

@r0x0d r0x0d force-pushed the install-sub-man-through-yum branch from 421739b to 8f0c62f Compare April 8, 2024 16:34
@r0x0d

This comment was marked as outdated.

@r0x0d r0x0d force-pushed the install-sub-man-through-yum branch from 8f0c62f to 3718b00 Compare April 10, 2024 13:36
@r0x0d

This comment was marked as off-topic.

@r0x0d r0x0d force-pushed the install-sub-man-through-yum branch from 3718b00 to a3cc6f5 Compare April 16, 2024 14:13
@Venefilyn

This comment was marked as off-topic.

@r0x0d r0x0d force-pushed the install-sub-man-through-yum branch from a3cc6f5 to b8f9878 Compare April 16, 2024 19:18
convert2rhel/subscription.py Outdated Show resolved Hide resolved
@r0x0d
Copy link
Member Author

r0x0d commented May 16, 2024

/packit test --labels tier0

@r0x0d
Copy link
Member Author

r0x0d commented May 16, 2024

Tests failure seems unrelated

convert2rhel/repo.py Outdated Show resolved Hide resolved
convert2rhel/subscription.py Outdated Show resolved Hide resolved
convert2rhel/subscription.py Outdated Show resolved Hide resolved
convert2rhel/subscription.py Outdated Show resolved Hide resolved
@r0x0d r0x0d force-pushed the install-sub-man-through-yum branch 2 times, most recently from b9b608b to 2d45ebe Compare May 20, 2024 14:26
@r0x0d
Copy link
Member Author

r0x0d commented May 20, 2024

/packit test --labels tier0

@r0x0d r0x0d force-pushed the install-sub-man-through-yum branch from 2d45ebe to 816ac77 Compare May 20, 2024 18:46
@r0x0d r0x0d requested a review from bocekm May 20, 2024 18:48
@r0x0d
Copy link
Member Author

r0x0d commented May 20, 2024

/packit test --labels tier0

convert2rhel/subscription.py Outdated Show resolved Hide resolved
convert2rhel/repo.py Outdated Show resolved Hide resolved
convert2rhel/repo.py Outdated Show resolved Hide resolved
convert2rhel/repo.py Outdated Show resolved Hide resolved
convert2rhel/repo.py Outdated Show resolved Hide resolved
convert2rhel/repo.py Outdated Show resolved Hide resolved
convert2rhel/subscription.py Outdated Show resolved Hide resolved
@bookwar
Copy link
Contributor

bookwar commented May 21, 2024

/packit test --labels tier0

r0x0d and others added 6 commits May 21, 2024 09:17
In this commit, we are introducing the installation of
subscription-manager directly through a package manager, instead of
downloading the package first and then installing it with system package
manager.

This is necessary as we want to do GPG verification when installing
those set of packages, in which case, it was not available when we used
to download the packages and then install it via local install.

Notable changes in this commit are:
* Replacing installing subscription-manager to install it directly from
  the client-tools repository with gpg check enabled for all supported
  versions
* Minor refactor to RestorablePackageSet class to allow it to be generic
  and use custom repository paths and content to install packages
* Small tweak to call_yum_cmd to use the reposdir option as a list
  instead of a string
* Move subscription-manager constants to subscription.py module instead
  of the packages.py backup module
Dropped the other two setopts we had defined in the past, namely,
varsdir and reposdir, in order to accept only the params through
setopts.

Since we are introducing setopts in the previous commit, it makes sense
to drop the varsdir and reposdir in favour of using only setopts, which
maps to the same interface for yum/dnf.
Before, we were giving the ability to set up the repository to the
restorable class, now, we require that the repository is set by the
caller, and only let the restorable class where is the reposdir that it
needs to use to install the package.
The data gets read in binary, thus, when we pass that to the
write_temporary_repofile function it breaks, as it is expecting strings,
not bytes.
Removing a couple of unused code and comments that are outdated from the
code.
Included in this suggestions:

- Suggestions applyed from the GitHub UI
- Added a warning text to the docstring to tell the developers why we
  are using the client-tools repository the way we are using it
- Reworked the write_temporary_repofile function to raise an error in
  case of failure instead of just logging an warning message and
  returning None, which could lead to errors that are not handled
  properly
- Removed the dependencies_to_update function that is not necessary to
  be there anymore.

Co-authored-by: Michal Bocek <mbocek@redhat.com>
@r0x0d r0x0d force-pushed the install-sub-man-through-yum branch from 830d520 to 77a370c Compare May 21, 2024 12:32
@r0x0d r0x0d requested a review from bocekm May 21, 2024 12:51
- Add message to the download_repofile function exception. We raise and
  log as critical what happened.
- Improved comment in install_rhel_subscription_manager function to
  match what setopts is doing for OL7

Co-authored-by: Michal Bocek <mbocek@redhat.com>
@r0x0d r0x0d force-pushed the install-sub-man-through-yum branch from 77a370c to 2835f9f Compare May 21, 2024 13:16
@r0x0d
Copy link
Member Author

r0x0d commented May 21, 2024

/packit test --labels tier0

@r0x0d r0x0d merged commit 0bfc9ca into oamg:main May 21, 2024
32 of 33 checks passed
@r0x0d r0x0d deleted the install-sub-man-through-yum branch May 21, 2024 18:49
@hosekadam hosekadam mentioned this pull request May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request merge-after-tests-ok tests-run-tier0 PR ready to run the essential test suit. Equivalent to `/packit test --labels tier0`.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants