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

Fixes #37148 - Remove subscription and system purpose host statuses #10882

Merged
merged 1 commit into from
Feb 15, 2024

Conversation

jeremylenz
Copy link
Member

@jeremylenz jeremylenz commented Feb 6, 2024

What are the changes introduced in this pull request?

image

With SCA-Only the following host statuses are now irrelevant:

Katello::SubscriptionStatus,
Katello::PurposeSlaStatus,
Katello::PurposeRoleStatus,
Katello::PurposeUsageStatus,
Katello::PurposeAddonsStatus,
Katello::PurposeStatus

This PR makes the following changes:

  1. Remove the host statuses above
  2. Via a DB migration, remove both the status records and the user table preferences for subscription_status
  3. Remove the two subscription-related dashboard widgets
  4. Remove handling of Candlepin events whose sole purpose was to update the now-removed statuses.

Considerations taken when implementing this change?

Note that system purpose attributes are not removed here. You can still set release version, role, usage, etc. and these are still useful for reporting. What is removed are the statuses that tell you whether your syspurpose attributes are "correctly supported by a subscription" -- because that's not a thing with SCA always enabled.

Rather than remove Candlepin event handling entirely, I chose to still log these events in case that's needed for debugging. I figure once there are no more Candlepin events to handle, that will be a good time to actually remove the event handler.

What are the testing steps for this pull request?

Make sure you've run

bundle exec rake katello:upgrades:4.12:update_content_access_modes

before beginning to test.

Create a TablePreference by going to the old host UI and clicking 'Manage columns,' then select "Subscription status" and a few others from the Content section.

You can see this in bundle exec rails console via

::TablePreference.all

You will see that "subscription_status" is included in the columns field.

Run migrations:

bundle exec rails db:migrate

Now, you should see that "subscription_status" is removed from your TablePreference. Also, this should now return nothing:

obsolete_statuses = [
      "Katello::SubscriptionStatus",
      "Katello::PurposeStatus",
      "Katello::PurposeAddonsStatus",
      "Katello::PurposeRoleStatus",
      "Katello::PurposeSlaStatus",
      "Katello::PurposeUsageStatus"
    ]

    ::HostStatus::Status.where(type: obsolete_statuses)

Make sure everything still works:

  • Legacy content host details - Setting syspurpose attributes
  • New host details - Setting syspurpose attributes
  • Activation keys - setting syspurpose attributes
  • Dashboard - widgets
  • Host status views

@jeremylenz jeremylenz marked this pull request as ready for review February 6, 2024 19:26
@chris1984 chris1984 self-assigned this Feb 7, 2024
@jeremylenz
Copy link
Member Author

[test katello]

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.

ACK, works great:

Screenshots:
Setting syspurpose on an AK
aksys

Setting syspurpose on the old UI:
olduisys

Setting syspurpose on the new UI:
newuisys

Legacy content host details - Setting syspurpose attributes - Pass
New host details - Setting syspurpose attributes - Pass
Activation keys - setting syspurpose attributes - Pass
Dashboard - widgets - Pass
Host status views - Pass and don't see the old status's anymore

The rails console showing the status are gone and table perferences:

Before:

[1] pry(main)> ::TablePreference.all
=> [#<TablePreference:0x0000559cc877a078
  id: 1,
  name: "hosts",
  columns: ["power_status", "name", "subscription_status", "rhel_lifecycle_status", "last_checkin"],
  created_at: Wed, 07 Feb 2024 21:30:31.591053000 UTC +00:00,
  updated_at: Wed, 07 Feb 2024 21:30:31.591053000 UTC +00:00,
  user_id: 4>]
=> ["Katello::SubscriptionStatus", "Katello::PurposeStatus", "Katello::PurposeAddonsStatus", "Katello::PurposeRoleStatus", "Katello::PurposeSlaStatus", "Katello::PurposeUsageStatus"]
[3] pry(main)> ::HostStatus::Status.where(type: obsolete_statuses)
=> [#<Katello::SubscriptionStatus:0x000055aa0260ebe8 id: 1, type: "Katello::SubscriptionStatus", status: 5, host_id: 1, reported_at: "[FILTERED]">]

After:

[1] pry(main)> ::TablePreference.all
=> [#<TablePreference:0x0000559cbceee900
  id: 1,
  name: "hosts",
  columns: ["power_status", "name", "rhel_lifecycle_status", "last_checkin"],
  created_at: Wed, 07 Feb 2024 21:30:31.591053000 UTC +00:00,
  updated_at: Wed, 07 Feb 2024 21:32:10.328577000 UTC +00:00,
  user_id: 4>]
=> ["Katello::SubscriptionStatus", "Katello::PurposeStatus", "Katello::PurposeAddonsStatus", "Katello::PurposeRoleStatus", "Katello::PurposeSlaStatus", "Katello::PurposeUsageStatus"]
[3] pry(main)> ::HostStatus::Status.where(type: obsolete_statuses)
=> []

@parthaa if you want to take a look, but stuff looks pretty good as far as code wise, but could use a second set of eyes. +1 to keeping the messages around for debugging.

@jeremylenz
Copy link
Member Author

[test katello]

@jeremylenz
Copy link
Member Author

@parthaa Added fake class.

@jeremylenz
Copy link
Member Author

squashed ✔️

@jeremylenz jeremylenz merged commit 89a802a into Katello:master Feb 15, 2024
16 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.

3 participants