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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ def content_hosts
.preload(:subscription_facet, :host_statuses, :operatingsystem,
:applicable_rpms, :content_view_environments)
csv_response(@hosts,
[:name, :subscription_status_label, 'content_facet.installable_security_errata_count',
[:name, 'content_facet.installable_security_errata_count',
'content_facet.installable_bugfix_errata_count', 'content_facet.installable_enhancement_errata_count',
'content_facet.upgradable_rpm_count', :operatingsystem, :content_view_environment_names,
'subscription_facet.registered_at', 'subscription_facet.last_checkin'],
['Name', 'Subscription Status', 'Installable Updates - Security',
['Name', 'Installable Updates - Security',
'Installable Updates - Bug Fixes', 'Installable Updates - Enhancements',
'Installable Updates - Package Count', 'OS', 'Content View Environments',
'Registered', 'Last Checkin'])
Expand Down
20 changes: 0 additions & 20 deletions app/helpers/katello/concerns/dashboard_helper_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,6 @@ def total_host_count
host_query.size
end

def partial_consumer_count
host_query.search_for("subscription_status = partial").size
end

def valid_consumer_count
host_query.search_for("subscription_status = valid").size
end

def invalid_consumer_count
host_query.search_for("subscription_status = invalid").size
end

def unknown_consumer_count
host_query.search_for("subscription_status = unknown or (null? subscription_uuid)").size
end

def unsubscribed_hypervisor_count
host_query.search_for("subscription_status = unsubscribed_hypervisor").size
end

def removed_widgets
widgets = super

Expand Down
1 change: 0 additions & 1 deletion app/lib/actions/katello/host/hypervisors_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ def update_subscription_facet(uuid, host)
host.subscription_facet.candlepin_consumer.consumer_attributes = @candlepin_attributes[uuid]
host.subscription_facet.import_database_attributes
host.subscription_facet.save!
host.subscription_facet.update_subscription_status(@candlepin_attributes[uuid].try(:[], :entitlementStatus))
end
end

Expand Down
55 changes: 1 addition & 54 deletions app/models/katello/concerns/host_managed_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -410,18 +410,6 @@ def import_tracer_profile(tracer_profile)
update_trace_status
end

def subscription_status
@subscription_status ||= get_status(::Katello::SubscriptionStatus).status
end

def subscription_status_label(options = {})
@subscription_status_label ||= get_status(::Katello::SubscriptionStatus).to_label(options)
end

def subscription_global_status
@subscription_global_status ||= get_status(::Katello::SubscriptionStatus).to_global
end

def errata_status
@errata_status ||= get_status(::Katello::ErrataStatus).status
end
Expand All @@ -430,46 +418,6 @@ def errata_status_label(options = {})
@errata_status_label ||= get_status(::Katello::ErrataStatus).to_label(options)
end

def purpose_status
@purpose_status ||= get_status(::Katello::PurposeStatus).status
end

def purpose_status_label(options = {})
@purpose_status_label ||= get_status(::Katello::PurposeStatus).to_label(options)
end

def purpose_sla_status
@purpose_sla_status ||= get_status(::Katello::PurposeSlaStatus).status
end

def purpose_sla_status_label(options = {})
@purpose_sla_status_label ||= get_status(::Katello::PurposeSlaStatus).to_label(options)
end

def purpose_role_status
@purpose_role_status ||= get_status(::Katello::PurposeRoleStatus).status
end

def purpose_role_status_label(options = {})
@purpose_role_status_label ||= get_status(::Katello::PurposeRoleStatus).to_label(options)
end

def purpose_usage_status
@purpose_usage_status ||= get_status(::Katello::PurposeUsageStatus).status
end

def purpose_usage_status_label(options = {})
@purpose_usage_status_label ||= get_status(::Katello::PurposeUsageStatus).to_label(options)
end

def purpose_addons_status
@purpose_addons_status ||= get_status(::Katello::PurposeAddonsStatus).status
end

def purpose_addons_status_label(options = {})
@purpose_addons_status_label ||= get_status(::Katello::PurposeAddonsStatus).to_label(options)
end

def rhel_lifecycle_global_status
@rhel_lifecycle_global_status ||= get_status(::Katello::RhelLifecycleStatus).to_global
end
Expand Down Expand Up @@ -602,8 +550,7 @@ class ::Host::Managed::Jail < Safemode::Jail
:host_collections, :pools, :hypervisor_host, :installed_debs,
:installed_packages, :traces_helpers, :advisory_ids, :package_names_for_job_template,
:filtered_entitlement_quantity_consumed, :bound_repositories,
:single_content_view, :single_lifecycle_environment, :purpose_role, :purpose_usage, :release_version,
:purpose_role_status_label, :purpose_usage_status_label
:single_content_view, :single_lifecycle_environment, :release_version
end

class ActiveRecord::Associations::CollectionProxy::Jail < Safemode::Jail
Expand Down
27 changes: 0 additions & 27 deletions app/models/katello/concerns/subscription_facet_host_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,15 @@ module SubscriptionFacetHostExtensions
included do
audited :associations => [:pools]

SUBSCRIPTION_STATUS_MAP = {
:valid => Katello::SubscriptionStatus::VALID,
:partial => Katello::SubscriptionStatus::PARTIAL,
:invalid => Katello::SubscriptionStatus::INVALID,
:unknown => Katello::SubscriptionStatus::UNKNOWN,
:disabled => Katello::SubscriptionStatus::DISABLED,
:unsubscribed_hypervisor => Katello::SubscriptionStatus::UNSUBSCRIBED_HYPERVISOR
}.freeze

accepts_nested_attributes_for :subscription_facet, :update_only => true, :reject_if => lambda { |attrs| attrs.values.compact.empty? }

has_many :activation_keys, :through => :subscription_facet
has_many :pools, :through => :subscription_facet
has_many :purpose_addons, :through => :subscription_facet
has_many :subscriptions, :through => :pools
has_one :subscription_status_object, :class_name => 'Katello::SubscriptionStatus', :foreign_key => 'host_id', :dependent => :destroy
has_one :purpose_sla_status_object, :class_name => 'Katello::PurposeSlaStatus', :foreign_key => 'host_id', :dependent => :destroy
has_one :purpose_role_status_object, :class_name => 'Katello::PurposeRoleStatus', :foreign_key => 'host_id', :dependent => :destroy
has_one :purpose_usage_status_object, :class_name => 'Katello::PurposeUsageStatus', :foreign_key => 'host_id', :dependent => :destroy
has_one :purpose_addons_status_object, :class_name => 'Katello::PurposeAddonsStatus', :foreign_key => 'host_id', :dependent => :destroy
has_one :purpose_status_object, :class_name => 'Katello::PurposeStatus', :foreign_key => 'host_id', :dependent => :destroy
has_one :rhel_lifecycle_status_object, :class_name => 'Katello::RhelLifecycleStatus', :foreign_key => 'host_id', :dependent => :destroy
has_one :hypervisor_host, :through => :subscription_facet

scoped_search :on => :status, :relation => :subscription_status_object, :rename => :subscription_status,
:complete_value => SUBSCRIPTION_STATUS_MAP

scoped_search on: :status, relation: :purpose_sla_status_object, rename: :sla_status, complete_value: purpose_status_map
scoped_search on: :status, relation: :purpose_role_status_object, rename: :role_status, complete_value: purpose_status_map
scoped_search on: :status, relation: :purpose_usage_status_object, rename: :usage_status, complete_value: purpose_status_map
scoped_search on: :status, relation: :purpose_addons_status_object, rename: :addons_status, complete_value: purpose_status_map
scoped_search on: :status, relation: :purpose_status_object, rename: :purpose_status, complete_value: purpose_status_map
scoped_search on: :status, relation: :rhel_lifecycle_status_object, rename: :rhel_lifecycle_status, complete_value: rhel_lifecycle_status_map

scoped_search :on => :release_version, :relation => :subscription_facet, :complete_value => true, :only_explicit => true
Expand Down Expand Up @@ -98,10 +75,6 @@ def update_candlepin_associations(consumer_params = nil)
end

module ClassMethods
def purpose_status_map
::Katello::PurposeStatus.status_map
end

def rhel_lifecycle_status_map
::Katello::RhelLifecycleStatus.status_map
end
Expand Down
23 changes: 0 additions & 23 deletions app/models/katello/concerns/widget_extensions.rb

This file was deleted.

19 changes: 0 additions & 19 deletions app/models/katello/host/subscription_facet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def update_from_consumer_attributes(consumer_params)
end

def import_database_attributes(consumer_params = candlepin_consumer.consumer_attributes)
update_subscription_status(consumer_params[:entitlementStatus]) unless consumer_params[:entitlementStatus].blank?
update_hypervisor(consumer_params)
update_guests(consumer_params)

Expand Down Expand Up @@ -182,24 +181,6 @@ def update_dmi_uuid_override(host_uuid = nil)
param
end

def update_subscription_status(status_override = nil)
update_status(::Katello::SubscriptionStatus, status_override: status_override)

host.refresh_global_status!
end

def update_purpose_status(sla_status: nil, role_status: nil, usage_status: nil, addons_status: nil, purpose_status: nil)
# if this method is ever called such that we aren't sending the status params, we should pass along the candlepin_consumer
# in order to reduce HTTP requests into candlepin for each Status
update_status(::Katello::PurposeSlaStatus, status_override: sla_status)
update_status(::Katello::PurposeRoleStatus, status_override: role_status)
update_status(::Katello::PurposeUsageStatus, status_override: usage_status)
update_status(::Katello::PurposeAddonsStatus, status_override: addons_status)
update_status(::Katello::PurposeStatus, status_override: purpose_status)

host.refresh_global_status!
end

def self.override_dmi_uuid?(host_uuid)
Setting[:host_dmi_uuid_duplicates].include?(host_uuid)
end
Expand Down
28 changes: 0 additions & 28 deletions app/models/katello/purpose_addons_status.rb

This file was deleted.

28 changes: 0 additions & 28 deletions app/models/katello/purpose_role_status.rb

This file was deleted.

28 changes: 0 additions & 28 deletions app/models/katello/purpose_sla_status.rb

This file was deleted.

71 changes: 0 additions & 71 deletions app/models/katello/purpose_status.rb

This file was deleted.

Loading
Loading