Skip to content

CLOS-3344: Add a check for leftover cldeploy package repository files #36

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

Merged
merged 1 commit into from
May 21, 2025

Conversation

prilr
Copy link
Collaborator

@prilr prilr commented May 19, 2025

These files are created and used during cldeploy conversions. They have the following naming scheme: repo.cloudlinux.com_cloudlinux_8_BaseOS_x86_64_os_.repo
Normally these files are cleaned up by cldeploy before it finishes, but in some cases they can remain on the system.
When that happens, they can introduce issues with Elevate upgrades.

Therefore, we add a check to catch these cases in pre-upgrade.

These files are created and used during cldeploy conversions.
They have the following naming scheme: repo.cloudlinux.com_cloudlinux_8_BaseOS_x86_64_os_.repo
Normally these files are cleaned up by cldeploy before it finishes, but in some cases they can remain on the system.
When that happens, they can introduce issues with Elevate upgrades.

Therefore, we add a check to catch these cases in pre-upgrade.
@prilr prilr requested a review from Copilot May 19, 2025 06:22
Copy link

Thank you for contributing to the Leapp project!

Please note that every PR needs to comply with the Leapp Guidelines and must pass all tests in order to be mergeable.
If you want to request a review or rebuild a package in copr, you can use following commands as a comment:

  • review please @oamg/developers to notify leapp developers of the review request
  • /packit copr-build to submit a public copr build using packit

Packit will automatically schedule regression tests for this PR's build and latest upstream leapp build. If you need a different version of leapp from PR#42, use /packit test oamg/leapp#42

It is possible to schedule specific on-demand tests as well. Currently 2 test sets are supported, beaker-minimal and kernel-rt, both can be used to be run on all upgrade paths or just a couple of specific ones.
To launch on-demand tests with packit:

  • /packit test --labels kernel-rt to schedule kernel-rt tests set for all upgrade paths
  • /packit test --labels beaker-minimal-8.9to9.3,kernel-rt-8.9to9.3 to schedule kernel-rt and beaker-minimal test sets for 8.9->9.3 upgrade path

[Deprecated] To launch on-demand regression testing public members of oamg organization can leave the following comment:

  • /rerun to schedule basic regression tests using this pr build and latest upstream leapp build as artifacts
  • /rerun 42 to schedule basic regression tests using this pr build and leapp*PR42* as artifacts
  • /rerun-sst to schedule sst tests using this pr build and latest upstream leapp build as artifacts
  • /rerun-sst 42 to schedule sst tests using this pr build and leapp*PR42* as artifacts

Please open ticket in case you experience technical problem with the CI. (RH internal only)

Note: In case there are problems with tests not being triggered automatically on new PR/commit or pending for a long time, please contact leapp-infra.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a pre-upgrade check to detect leftover repository files created by the cldeploy tool under /etc/yum.repos.d, preventing them from blocking Elevate upgrades.

  • Introduce get_cldeploy_repo_files to filter out cldeploy‐style repo files by prefix.
  • Create a report if any leftover files are found, halting the upgrade.
  • Add a new actor (CheckCldeployRepofile) wired into the pre‐upgrade workflow.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
repos/system_upgrade/cloudlinux/actors/checkcldeployrepofile/tests/unit_test_checkcldeployrepofile.py Tests for the new get_cldeploy_repo_files helper
repos/system_upgrade/cloudlinux/actors/checkcldeployrepofile/libraries/checkcldeployrepofile.py Implements file‐filtering logic, report creation, and processing
repos/system_upgrade/cloudlinux/actors/checkcldeployrepofile/actor.py Defines the new actor that invokes the library on CloudLinux
Comments suppressed due to low confidence (4)

repos/system_upgrade/cloudlinux/actors/checkcldeployrepofile/tests/unit_test_checkcldeployrepofile.py:31

  • [nitpick] The test name refers to packages but exercises repository file detection. Rename it to something like test_get_cldeploy_repo_files for clarity.
def test_problem_packages_installed(repo_file_paths, expected_res):

repos/system_upgrade/cloudlinux/actors/checkcldeployrepofile/tests/unit_test_checkcldeployrepofile.py:15

  • The test fixture omits the .repo extension, but real cldeploy files end with .repo. Update the path to include the suffix so tests mirror real filenames.
/etc/yum.repos.d/repo.cloudlinux.com_cloudlinux_8_BaseOS_x86_64_os_

repos/system_upgrade/cloudlinux/actors/checkcldeployrepofile/actor.py:8

  • [nitpick] The class name CheckCldeployRepofile is hard to parse. Consider renaming to CheckClDeployRepoFile for consistency and readability.
class CheckCldeployRepofile(Actor):

repos/system_upgrade/cloudlinux/actors/checkcldeployrepofile/libraries/checkcldeployrepofile.py:23

  • There are no unit tests for create_report. Add tests to verify that reporting.create_report is called with the expected title, summary, severity, groups, and remediation.
def create_report(cldeploy_repo_files):

@Monstrofil
Copy link
Collaborator

lgtm

@prilr prilr merged commit deb73c0 into cloudlinux:cloudlinux May 21, 2025
1 check passed
@prilr prilr deleted the cldeploy-repos branch May 21, 2025 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants