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 #36693 - Add new host status for RHEL lifecycle #10706

Merged
merged 13 commits into from
Sep 1, 2023

Conversation

jeremylenz
Copy link
Member

@jeremylenz jeremylenz commented Aug 22, 2023

What are the changes introduced in this pull request?

  • Add a new host status, Katello::RhelLifecycleStatus which tells you if your RHEL system is getting close to EOS (end of support).
  • Hard-code a list of EOS schedules, which we'll have to update whenever they change and whenever a new major RHEL is released.
  • Add methods that can be used in a future report template
  • Update all relevant host statuses on host registration and checkin.
  • Update all relevant host statuses on errata recalculate.

image

image

Considerations taken when implementing this change?

What are the testing steps for this pull request?

Register at least one RHEL host. It should get a RHEL lifecycle status immediately on registration.
CentOS and other OS hosts will show "N/A" for RHEL lifecycle status.

To force host status updates:

host.refresh_statuses

note: This will refresh RHEL lifecycle status only for RHEL hosts. This is expected.

View host statuses on the new host details page, or in Rails console:

host.get_status(Katello::RhelLifecycleStatus).to_label
  • Verify that new host methods work
host.rhel_lifecycle_status
host.rhel_lifecycle_status_label
host.full_support_end_date
host.maintenance_support_end_date
host.extended_support_end_date
host.approaching_end_of_support_date
host.end_of_support_date
  • Newly registered hosts should have their statuses updated, as well as hosts checking in (subscription-manager repos)
  • Scoped search should work and auto-complete for the new statuses (rhel_lifecycle_status = full_support, etc.)
  • Fake different statuses by changing def self.to_status in app/models/katello/rhel_lifecycle_status.rb
  • Fake different EOS schedules by changing def rhel_eos_schedule in app/models/katello/concerns/operatingsystem_extensions.rb
return ["RHEL5", "RHEL6", "RHEL7", "RHEL8"].sample

@theforeman-bot
Copy link

Issues: #36693

@jeremylenz jeremylenz force-pushed the 36693-new-host-status-rhel branch 3 times, most recently from aa4add9 to 32842cb Compare August 22, 2023 20:51
@jeremylenz jeremylenz marked this pull request as ready for review August 23, 2023 17:41
@jeremylenz
Copy link
Member Author

[test katello]

@@ -44,6 +44,24 @@ def set_atomic_attributes
def atomic?
name.match(/.*atomic.*/i)
end

def rhel_eos_schedule
return nil unless name == "RedHat" # using name and not title so we get specifically RHEL, not rebuilds
Copy link
Member Author

Choose a reason for hiding this comment

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

Is it safe to assume all RHEL OSes use "RedHat" as the name? Or do some use "RHEL" ?

Copy link
Member

Choose a reason for hiding this comment

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

Seems they are all RedHat for RHEL 9, 8 and 7.

Copy link
Member Author

Choose a reason for hiding this comment

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

@chris1984 do you happen to know what the strings are for RHEL6 and RHEL5? 😄

Copy link
Member

Choose a reason for hiding this comment

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

@jeremylenz Should be good to go with 6 too:

irb(main):004:0> Operatingsystem.second
=> #<Redhat id: 6, major: "6", name: "RedHat", minor: "10", nameindicator: nil, created_at: "2023-09-01 13:51:18.161260000 +0000", updated_at: "2023-09-01 13:51:18.161260000 +0000", release_name: nil, type: "Redhat", description: nil, password_hash: [FILTERED], title: "RedHat 6.10">

Copy link
Member Author

Choose a reason for hiding this comment

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

narrator voice They were not good to go.

@jeremylenz jeremylenz force-pushed the 36693-new-host-status-rhel branch 2 times, most recently from aa96e14 to a934cc9 Compare August 29, 2023 18:22
@jeremylenz
Copy link
Member Author

Added maintenance_warn_date so RHEL7 should now show "Approaching end of maintenance support (2024-06-30)"

@jeremylenz
Copy link
Member Author

fixed tests

@lfu
Copy link
Member

lfu commented Aug 30, 2023

Added maintenance_warn_date so RHEL7 should now show "Approaching end of maintenance support (2024-06-30)"

I saw this message in green color 😃

@jeremylenz
Copy link
Member Author

@lfu Made approaching maintenance a warning status (should be yellow now) and cleaned up self.to_status.

@jeremylenz
Copy link
Member Author

@lfu Updated -

  • removed warn_date methods
  • added def self.approaching_end_of_category (sorry, I renamed it)
  • added case statements
  • updated tests
  • refresh only errata and RHEL lifecycle status during errata applicability check (which is during host checkin)

Copy link
Member

@lfu lfu left a comment

Choose a reason for hiding this comment

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

Nice job 👍🏻

@jeremylenz jeremylenz merged commit d442ec1 into Katello:master Sep 1, 2023
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants