Skip to content

Conversation

@jeremylenz
Copy link
Contributor

Problem Statement

Following PR #19931 which removed auto-attach, autoheal, and simple content access references, there were still remaining references to subscription attachment functionality throughout the codebase. Since SCA (Simple Content Access) is now the default mode for all organizations, subscription attachment to activation keys and hosts is no longer needed or possible.

Solution

This PR completes the cleanup by removing all remaining subscription attachment references:

Phase 1: Removed dead code and obsolete parameters

  • Removed activationkey_add_subscription_to_repo() helper method from cli_factory.py (unused)
  • Removed auto_attach=False parameters from test_rhcloud_iop.py (redundant in SCA mode)
  • Removed stubbed test test_positive_candlepin_events_processed_by_STOMP (never implemented)

Phase 2: Removed CLI wrapper methods

  • Removed ActivationKey.add_subscription(), remove_subscription(), and subscriptions()
  • Removed Host.subscription_attach() and subscription_remove()
  • Kept subscription_register() and subscription_unregister() (still needed for registration)

Phase 3: Cleaned up tests

  • Removed subscription attachment failure checks from test_sca_end_to_end
  • Test now focuses purely on SCA content access functionality

Phase 4: is_sca_mode_enabled cleanup

  • Removed all is_sca_mode_enabled() references from helper methods and tests
  • Removed conditional subscription attachment code from setup helpers

Files changed: 12 files changed, 5 insertions(+), 228 deletions(-)

Related Issues

Related to PR #19931

Since SCA (Simple Content Access) is now the default mode for all
organizations, subscription attachment to activation keys and hosts
is no longer needed or possible. This completes the cleanup started
in PR SatelliteQE#19931.

Changes:
- Remove activationkey_add_subscription_to_repo() helper (unused)
- Remove ActivationKey.add_subscription(), remove_subscription(), subscriptions()
- Remove Host.subscription_attach() and subscription_remove()
- Remove stubbed test_positive_candlepin_events_processed_by_STOMP
- Remove is_sca_mode_enabled() references from helpers and tests
- Remove conditional subscription attachment code from setup helpers
- Clean up subscription attachment checks from test_sca_end_to_end

12 files changed, 5 insertions(+), 228 deletions(-)
@jeremylenz jeremylenz requested review from a team as code owners November 6, 2025 15:46
@jeremylenz jeremylenz added the No-CherryPick PR doesnt need CherryPick to previous branches label Nov 6, 2025
Copy link
Contributor

@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 there - I've reviewed your changes - here's some feedback:

  • Now that Simple Content Access is always enabled, consider removing the is_sca_mode_enabled method and any related configuration flags entirely to eliminate leftover conditional logic.
  • With all subscription‐attach code gone, you can simplify setup_activation_key and setup_content helpers by dropping unused parameters and branches, streamlining their activation key creation flow.
  • Add a test to confirm that attempts to use the removed subscription attach/remove CLI commands now fail or are unrecognized, ensuring the user‐facing behavior is as expected.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Now that Simple Content Access is always enabled, consider removing the is_sca_mode_enabled method and any related configuration flags entirely to eliminate leftover conditional logic.
- With all subscription‐attach code gone, you can simplify setup_activation_key and setup_content helpers by dropping unused parameters and branches, streamlining their activation key creation flow.
- Add a test to confirm that attempts to use the removed subscription attach/remove CLI commands now fail or are unrecognized, ensuring the user‐facing behavior is as expected.

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.

Copy link
Contributor

@vsedmik vsedmik left a comment

Choose a reason for hiding this comment

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

One question bellow, otherwise looks good to me!

Comment on lines +2484 to +2485
# refresh repository metadata on the host
rhel_contenthost.execute('subscription-manager repos --list')
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we don't need this, but I don't mind keeping it either.

Copy link
Contributor

@LadislavVasina1 LadislavVasina1 left a comment

Choose a reason for hiding this comment

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

Changes look good to me, thanks @jeremylenz

Addresses PR review feedback by removing all remaining references to subscription attachment methods that were removed in the initial PR. This includes removing calls to ActivationKey.subscriptions() and Host.subscription_attach() in tests, removing subscription attachment API endpoints from the API test file, and cleaning up the unused rh_subscriptions parameter from helper methods since subscription attachment is no longer supported in SCA mode.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@jeremylenz
Copy link
Contributor Author

Opened SatelliteQE/nailgun#1377

@jeremylenz
Copy link
Contributor Author

@jameerpathan111 updated

Copy link
Member

@ColeHiggins2 ColeHiggins2 left a comment

Choose a reason for hiding this comment

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

im assuming you double checked that any usage for any removed method or functions was updated or caused no failures? maybe we can run a PRT job on subscriptions or activation keys and make sure tests are passing at a reasonable percentage?

@ColeHiggins2
Copy link
Member

trigger: test-robottelo
pytest: tests/foreman/ui/test_activationkey.py
nailgun: 1377

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 13438
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_activationkey.py --external-logging
Test Result : =============== 59 passed, 1105 warnings in 11694.00s (3:14:54) ================

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Nov 11, 2025
Copy link
Contributor

@jnagare-redhat jnagare-redhat left a comment

Choose a reason for hiding this comment

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

LGTM

@jameerpathan111
Copy link
Contributor

@jeremylenz thanks for raising this PR and addressing the requested changes. It should fix many test failures.

@jameerpathan111 jameerpathan111 merged commit 4cde892 into SatelliteQE:master Nov 11, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No-CherryPick PR doesnt need CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants