Skip to content

Conversation

@jeremylenz
Copy link
Member

@jeremylenz jeremylenz commented Oct 9, 2025

What are the changes introduced in this pull request?

Now that all organizations are SCA-only, this PR removes obsolete subscription management functionality:

  • Removed Dynflow actions: SCA toggle (Enable/Disable/Toggle), host subscription management (AttachSubscriptions, AutoAttachSubscriptions, RemoveSubscriptions)
  • Removed auto_attach attribute from activation keys
  • Removed autoheal attribute from subscription facets
  • Added database migrations to remove the columns
  • Updated all API controllers, Candlepin/Katello actions, resources, views, tests, and JavaScript

Considerations taken when implementing this change?

From Jeremy:
I know this is a lot of lines / files changed. But if you remove the Dynflow actions, you must also remove any API endpoints and params that use them. So it makes sense to remove them together.

From Claude:

  • Database migrations remove columns that are no longer used
  • All tests have been updated to remove references to the removed functionality
  • JavaScript snapshots have been updated
  • No user-facing functionality is affected as all orgs are already SCA-only

What are the testing steps for this pull request?

Run the migration
Idk.. test activation key create/update and host content access, make sure everything still works

Note: If you switch away from the branch, you'll want to run rails db:rollback

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 and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `test/controllers/api/v2/hosts_controller_test.rb:259-266` </location>
<code_context>
     Katello::Candlepin::Consumer.any_instance.stubs(:installed_products).returns([])

     host = FactoryBot.create(:host, :with_subscription, :with_operatingsystem)
-    host.subscription_facet.update!(:autoheal => true,
+    host.subscription_facet.update!(:service_level => 'Premium',
                                                :installed_products_attributes => [{:product_name => 'foo', :version => '6', :product_id => '69'}])

-    put :update, params: { :id => host.id, :subscription_facet_attributes => {:autoheal => false} }
+    put :update, params: { :id => host.id, :subscription_facet_attributes => {:service_level => 'Standard'} }

     assert_response :success

-    refute host.reload.subscription_facet.reload.autoheal
+    assert_equal 'Standard', host.reload.subscription_facet.reload.service_level
     assert_equal 'foo', host.subscription_facet.installed_products.first.name
</code_context>

<issue_to_address>
**suggestion (testing):** Test for updating autoheal removed and replaced with service_level.

Also, add tests for invalid and missing service_level values to ensure robust coverage.
</issue_to_address>

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.

@jeremylenz jeremylenz force-pushed the 38823-remove-auto-attach-autoheal branch from f8aeff8 to 676996d Compare October 14, 2025 19:03
Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

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

Tested:
Hammer was tested in Katello/hammer-cli-katello#1006
virt-who checkin - Pass
activation-key create - Pass
activation-key update - Pass
Import a manifest - Pass
Refresh a manifest - Pass
Register a host - Pass
Look at host details to make sure fields are not preset - Pass
Check the api response to make sure fields are not present when looking at a host - Pass
Add subscriptions to manifest - Pass

I found some subscription related stuff in the controllers, since you are removing add/remove subscription endpoints, should we remove these?

https://github.com/jeremylenz/katello/blob/906c30f3b7f0ea186b8aac330adac0185c2cb2b9/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb#L16
https://github.com/jeremylenz/katello/blob/906c30f3b7f0ea186b8aac330adac0185c2cb2b9/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb#L19
https://github.com/jeremylenz/katello/blob/906c30f3b7f0ea186b8aac330adac0185c2cb2b9/app/controllers/katello/api/v2/host_subscriptions_controller.rb#L37
https://github.com/jeremylenz/katello/blob/906c30f3b7f0ea186b8aac330adac0185c2cb2b9/app/controllers/katello/api/v2/activation_keys_controller.rb#L10

@jeremylenz
Copy link
Member Author

@chris1984 Good catches! I think we got it all now, let's see

Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

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

Looks like they are all gone, just one in question:

Should we remove this one too or at least change the action from create?

match '/subscriptions/' => 'host_subscriptions#create', :via => :post

Removed add_subscriptions and remove_subscriptions endpoints and related code:
- Removed subscription methods from activation_keys and hosts_bulk_actions controllers
- Removed subscription routes from API and overrides
- Removed subscription permissions from permission files
- Removed subscription-related tests

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

Co-Authored-By: Claude <[email protected]>
@jeremylenz jeremylenz force-pushed the 38823-remove-auto-attach-autoheal branch from 98068c1 to 8dad61c Compare October 27, 2025 21:04
@jeremylenz
Copy link
Member Author

Should we remove this one too or at least change the action from create?

Turns out this one should stay. host_subscriptions#create is used in hammer host subscription register which is for registering a fake host. It's used in Robottelo tests.

I did find and fix the wording on one of the params (it mentioned "auto-healing") so thanks for catching that!

@chris1984
Copy link
Member

Should we remove this one too or at least change the action from create?

Turns out this one should stay. host_subscriptions#create is used in hammer host subscription register which is for registering a fake host. It's used in Robottelo tests.

I did find and fix the wording on one of the params (it mentioned "auto-healing") so thanks for catching that!

Thanks for fixing the wording!

@jeremylenz jeremylenz merged commit 244654f into Katello:master Oct 28, 2025
20 of 21 checks passed
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