Skip to content

fix: skip package profile upload when disabled in config#3714

Merged
DuckBoss merged 1 commit intomainfrom
jajerome/fix-package-profile-upload
Mar 5, 2026
Merged

fix: skip package profile upload when disabled in config#3714
DuckBoss merged 1 commit intomainfrom
jajerome/fix-package-profile-upload

Conversation

@DuckBoss
Copy link
Contributor

@DuckBoss DuckBoss commented Mar 3, 2026

This patch checks the rhsm config to ensure the
"report_package_profile" setting is not ignored during registration.
Previously, this setting was ignored and the package profile was forced to upload.

Resolves: RHEL-73923

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 3, 2026

Reviewer's Guide

This PR makes package profile upload during registration respect the rhsm.conf report_package_profile setting, removing the previous unconditional forced upload and covering the new behavior with targeted registration tests.

Sequence diagram for registration package profile upload respecting report_package_profile

sequenceDiagram
    actor User
    participant RegisterCLI as RegisterCLICommand
    participant RHSMConf as RhsmConfig
    participant EntCertLib as EntitlementCertLib
    participant ProfileMgr as ProfileManager
    participant Rhsmcertd as RhsmcertdDaemon

    User->>RegisterCLI: run register
    RegisterCLI->>EntCertLib: update()
    EntCertLib-->>RegisterCLI: updated entitlements

    RegisterCLI->>RHSMConf: get_int(report_package_profile)
    RHSMConf-->>RegisterCLI: value (0 or 1)

    alt report_package_profile == 1
        RegisterCLI->>RegisterCLI: _upload_profile(consumer)
        RegisterCLI->>Rhsmcertd: send SIGUSR1
        Rhsmcertd-->>RegisterCLI: signal received
        Rhsmcertd->>ProfileMgr: update_check(cp, consumer_uuid)
        ProfileMgr-->>Rhsmcertd: profile upload result
    else report_package_profile != 1
        RegisterCLI->>RegisterCLI: log skip message
    end

    RegisterCLI->>RegisterCLI: _request_validity_check()
    RegisterCLI-->>User: registration result
Loading

Flow diagram for deciding whether to upload package profile on registration

flowchart TD
    A[Start registration] --> B[Update entitlement certificates]
    B --> C[Read rhsm.conf rhsm.report_package_profile]
    C --> D{report_package_profile == 1?}
    D -- Yes --> E[Call _upload_profile]
    E --> F[Send SIGUSR1 to rhsmcertd]
    F --> G[rhsmcertd uploads package profile using ProfileManager.update_check without force]
    G --> H[Request validity check]
    D -- No --> I[Log skipping package profile upload]
    I --> H[Request validity check]
    H --> J[End]
Loading

File-Level Changes

Change Details Files
Gate package profile upload on the report_package_profile configuration option instead of always forcing an upload.
  • Removed the force=True argument from the profile manager update_check call in the blocking upload path so it follows normal configuration behavior.
  • Removed comments that documented the previous forced-upload behavior and ignoring of the configuration option.
  • Wrapped the call to _upload_profile in _do_command with a conditional that only triggers the upload when conf["rhsm"].get_int("report_package_profile") == 1, logging a skip message otherwise.
src/subscription_manager/cli_command/register.py
Add registration tests to verify package profile upload is skipped or executed based on report_package_profile.
  • Patched the conf object in registration tests to simulate report_package_profile being disabled (0) and assert that _upload_profile is not called while registration output remains correct.
  • Patched the conf object to simulate report_package_profile being enabled (1) and assert that _upload_profile is called exactly once while registration succeeds.
  • Used a stubbed UEPConnection and Capture to keep tests consistent with existing registration testing patterns.
test/test_registration.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The two new tests for enabled/disabled package profile upload duplicate most of their setup and assertions; consider refactoring them into a single parametrized helper to reduce repetition and keep future changes in sync.
  • The check conf["rhsm"].get_int("report_package_profile") == 1 hardcodes the magic value 1; if possible, prefer a boolean or a named constant to make the intent clearer and avoid relying on specific numeric values.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The two new tests for enabled/disabled package profile upload duplicate most of their setup and assertions; consider refactoring them into a single parametrized helper to reduce repetition and keep future changes in sync.
- The check `conf["rhsm"].get_int("report_package_profile") == 1` hardcodes the magic value `1`; if possible, prefer a boolean or a named constant to make the intent clearer and avoid relying on specific numeric values.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@DuckBoss DuckBoss force-pushed the jajerome/fix-package-profile-upload branch from a0123cb to 7a2ca35 Compare March 3, 2026 20:55
@cnsnyder cnsnyder self-requested a review March 4, 2026 15:13
@DuckBoss DuckBoss force-pushed the jajerome/fix-package-profile-upload branch 2 times, most recently from 91932ce to 1d23974 Compare March 4, 2026 17:06
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

Coverage

Coverage (computed on Fedora latest) •
FileStmtsMissBranchBrPartCoverMissing
subscription_manager/cli_command
   register.py19443661777%118, 120, 163–165, 167–168, 171, 182, 186, 192–195, 199–200, 204–205, 240, 244–246, 257, 283, 299–300, 336, 360, 368, 383–385, 394, 425, 435–436, 443–444, 449–453
TOTAL1722344574746177974% 

Tests Skipped Failures Errors Time
2445 14 💤 0 ❌ 0 🔥 24.653s ⏱️

@DuckBoss DuckBoss force-pushed the jajerome/fix-package-profile-upload branch from 1d23974 to 59ddcdd Compare March 4, 2026 17:09
Copy link
Contributor

@jirihnidek jirihnidek left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I have one request to revert one small changes in your code. The reason is explained in the comment.

@DuckBoss DuckBoss force-pushed the jajerome/fix-package-profile-upload branch 3 times, most recently from ce3f3d2 to 2a9076b Compare March 5, 2026 14:23
@DuckBoss DuckBoss requested a review from jirihnidek March 5, 2026 14:25
Copy link
Contributor

@jirihnidek jirihnidek left a comment

Choose a reason for hiding this comment

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

Thanks for your updates. LGTM now.

This patch checks the rhsm config to ensure the
"report_package_profile" setting is not ignored during
registration. Previously, this setting was ignored and
the package profile was forced to upload.

Resolves: RHEL-73923

AI Usage Disclosure: This commit contains test cases that were
created with the assistance of AI tools.
Signed-off-by: Jason Jerome <[email protected]>
@DuckBoss DuckBoss force-pushed the jajerome/fix-package-profile-upload branch from 2a9076b to 95b9371 Compare March 5, 2026 17:24
@jsefler
Copy link
Contributor

jsefler commented Mar 5, 2026

LGTM from a pre-merge functional test perspective. Please merge to main.

@DuckBoss DuckBoss merged commit 40a2295 into main Mar 5, 2026
28 of 29 checks passed
@DuckBoss DuckBoss deleted the jajerome/fix-package-profile-upload branch March 5, 2026 23:22
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.

4 participants