diff --git a/app/controllers/katello/concerns/hosts_controller_extensions.rb b/app/controllers/katello/concerns/hosts_controller_extensions.rb
index f19c3742103..dbe4177f380 100644
--- a/app/controllers/katello/concerns/hosts_controller_extensions.rb
+++ b/app/controllers/katello/concerns/hosts_controller_extensions.rb
@@ -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'])
diff --git a/app/helpers/katello/concerns/dashboard_helper_extensions.rb b/app/helpers/katello/concerns/dashboard_helper_extensions.rb
index 4bbbb8acb7e..3e5a71bb5a8 100644
--- a/app/helpers/katello/concerns/dashboard_helper_extensions.rb
+++ b/app/helpers/katello/concerns/dashboard_helper_extensions.rb
@@ -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
diff --git a/app/lib/actions/katello/host/hypervisors_update.rb b/app/lib/actions/katello/host/hypervisors_update.rb
index efbb9a2210d..70815bffad7 100644
--- a/app/lib/actions/katello/host/hypervisors_update.rb
+++ b/app/lib/actions/katello/host/hypervisors_update.rb
@@ -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
diff --git a/app/models/katello/concerns/host_managed_extensions.rb b/app/models/katello/concerns/host_managed_extensions.rb
index 18a917977d5..c483fa6b772 100644
--- a/app/models/katello/concerns/host_managed_extensions.rb
+++ b/app/models/katello/concerns/host_managed_extensions.rb
@@ -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
@@ -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
@@ -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
diff --git a/app/models/katello/concerns/subscription_facet_host_extensions.rb b/app/models/katello/concerns/subscription_facet_host_extensions.rb
index 84169844279..50087fce980 100644
--- a/app/models/katello/concerns/subscription_facet_host_extensions.rb
+++ b/app/models/katello/concerns/subscription_facet_host_extensions.rb
@@ -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
@@ -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
diff --git a/app/models/katello/concerns/widget_extensions.rb b/app/models/katello/concerns/widget_extensions.rb
deleted file mode 100644
index 0168351c6b3..00000000000
--- a/app/models/katello/concerns/widget_extensions.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-module Katello
- module Concerns
- module WidgetExtensions
- extend ActiveSupport::Concern
-
- module ClassMethods
- SUBSCRIPTION_TEMPLATES = %w[subscription_status_widget subscription_widget].freeze
-
- def without_subscription_widgets
- where.not(template: ::Widget.singleton_class::SUBSCRIPTION_TEMPLATES)
- end
-
- def available
- if Organization.current&.simple_content_access?
- super.without_subscription_widgets
- else
- super
- end
- end
- end
- end
- end
-end
diff --git a/app/models/katello/host/subscription_facet.rb b/app/models/katello/host/subscription_facet.rb
index 9c4aa68d8e6..eafccd10113 100644
--- a/app/models/katello/host/subscription_facet.rb
+++ b/app/models/katello/host/subscription_facet.rb
@@ -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)
@@ -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
diff --git a/app/models/katello/purpose_addons_status.rb b/app/models/katello/purpose_addons_status.rb
deleted file mode 100644
index 75893e570c3..00000000000
--- a/app/models/katello/purpose_addons_status.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-module Katello
- class PurposeAddonsStatus < HostStatus::Status
- UNKNOWN = Katello::PurposeStatus::UNKNOWN
- def self.status_name
- N_('Addons')
- end
-
- def self.humanized_name
- 'purpose_addons'
- end
-
- def to_label(_options = {})
- Katello::PurposeStatus.to_label(status)
- end
-
- def to_status(options = {})
- Katello::PurposeStatus.to_status(self, :addons_status, options)
- end
-
- def relevant?(_options = {})
- host.subscription_facet.try(:uuid)
- end
-
- def substatus?(_options = {})
- true
- end
- end
-end
diff --git a/app/models/katello/purpose_role_status.rb b/app/models/katello/purpose_role_status.rb
deleted file mode 100644
index 3a5aee9ef20..00000000000
--- a/app/models/katello/purpose_role_status.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-module Katello
- class PurposeRoleStatus < HostStatus::Status
- UNKNOWN = Katello::PurposeStatus::UNKNOWN
- def self.status_name
- N_('Role')
- end
-
- def self.humanized_name
- 'purpose_role'
- end
-
- def to_label(_options = {})
- Katello::PurposeStatus.to_label(status)
- end
-
- def to_status(options = {})
- Katello::PurposeStatus.to_status(self, :role_status, options)
- end
-
- def relevant?(_options = {})
- host.subscription_facet.try(:uuid)
- end
-
- def substatus?(_options = {})
- true
- end
- end
-end
diff --git a/app/models/katello/purpose_sla_status.rb b/app/models/katello/purpose_sla_status.rb
deleted file mode 100644
index 0d85f17294e..00000000000
--- a/app/models/katello/purpose_sla_status.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-module Katello
- class PurposeSlaStatus < HostStatus::Status
- UNKNOWN = Katello::PurposeStatus::UNKNOWN
- def self.status_name
- N_('Service level')
- end
-
- def self.humanized_name
- 'purpose_sla'
- end
-
- def to_label(_options = {})
- Katello::PurposeStatus.to_label(status)
- end
-
- def to_status(options = {})
- Katello::PurposeStatus.to_status(self, :sla_status, options)
- end
-
- def relevant?(_options = {})
- host.subscription_facet.try(:uuid)
- end
-
- def substatus?(_options = {})
- true
- end
- end
-end
diff --git a/app/models/katello/purpose_status.rb b/app/models/katello/purpose_status.rb
deleted file mode 100644
index b83cda2b4d1..00000000000
--- a/app/models/katello/purpose_status.rb
+++ /dev/null
@@ -1,71 +0,0 @@
-module Katello
- class PurposeStatus < HostStatus::Status
- UNKNOWN = 0
- MISMATCHED = 1
- MATCHED = 2
- NOT_SPECIFIED = 3
-
- def self.status_map
- map = {
- mismatched: MISMATCHED,
- matched: MATCHED,
- not_specified: NOT_SPECIFIED
- }
-
- map.default = UNKNOWN
- map
- end
-
- def self.status_name
- N_('System purpose')
- end
-
- def self.humanized_name
- 'purpose'
- end
-
- def self.to_label(status)
- case status
- when MATCHED
- N_('Matched')
- when MISMATCHED
- N_('Mismatched')
- when NOT_SPECIFIED
- N_('Not specified')
- else
- N_('Unknown')
- end
- end
-
- def self.to_status(status, purpose_method, options)
- return UNKNOWN unless status.relevant?
-
- if options.key?(:status_override)
- return self.status_map[options[:status_override]]
- end
-
- consumer = status.host.subscription_facet.candlepin_consumer
- self.status_map[consumer.system_purpose.send(purpose_method)]
- end
-
- def to_label(_options = {})
- self.class.to_label(status)
- end
-
- def to_global(_options = {})
- if [MATCHED, UNKNOWN, NOT_SPECIFIED].include?(status)
- ::HostStatus::Global::OK
- else
- ::HostStatus::Global::WARN
- end
- end
-
- def to_status(options = {})
- self.class.to_status(self, :overall_status, options)
- end
-
- def relevant?(_options = {})
- host.subscription_facet.try(:uuid)
- end
- end
-end
diff --git a/app/models/katello/purpose_usage_status.rb b/app/models/katello/purpose_usage_status.rb
deleted file mode 100644
index 6c14fb78c7d..00000000000
--- a/app/models/katello/purpose_usage_status.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-module Katello
- class PurposeUsageStatus < HostStatus::Status
- UNKNOWN = Katello::PurposeStatus::UNKNOWN
- def self.status_name
- N_('Usage')
- end
-
- def self.humanized_name
- 'purpose_usage'
- end
-
- def to_label(_options = {})
- Katello::PurposeStatus.to_label(status)
- end
-
- def to_status(options = {})
- Katello::PurposeStatus.to_status(self, :usage_status, options)
- end
-
- def relevant?(_options = {})
- host.subscription_facet.try(:uuid)
- end
-
- def substatus?(_options = {})
- true
- end
- end
-end
diff --git a/app/models/katello/subscription_status.rb b/app/models/katello/subscription_status.rb
deleted file mode 100644
index c33b0cde635..00000000000
--- a/app/models/katello/subscription_status.rb
+++ /dev/null
@@ -1,71 +0,0 @@
-module Katello
- class SubscriptionStatus < HostStatus::Status
- DISABLED = 5
- UNSUBSCRIBED_HYPERVISOR = 4
- UNKNOWN = 3
- INVALID = 2
- PARTIAL = 1
- VALID = 0
-
- def self.status_name
- N_("Subscription")
- end
-
- def to_label(_options = {})
- case status
- when VALID
- N_("Fully entitled")
- when PARTIAL
- N_("Partially entitled")
- when INVALID
- N_("Unentitled")
- when UNSUBSCRIBED_HYPERVISOR
- N_("Unsubscribed hypervisor")
- when DISABLED
- N_("Simple Content Access")
- else
- N_("Unknown subscription status")
- end
- end
-
- def to_global(_options = {})
- case status
- when INVALID
- ::HostStatus::Global::ERROR
- when DISABLED
- ::HostStatus::Global::OK
- when VALID
- ::HostStatus::Global::OK
- else
- ::HostStatus::Global::WARN
- end
- end
-
- def to_status(options = {})
- return UNKNOWN unless host.subscription_facet.try(:uuid)
- return DISABLED if host.organization.simple_content_access?
- status_override = 'unsubscribed_hypervisor' if host.subscription_facet.unsubscribed_hypervisor?
- status_override ||= options.fetch(:status_override, nil)
- status = status_override || host.subscription_facet.candlepin_consumer.entitlement_status
-
- case status
- when Katello::Candlepin::Consumer::ENTITLEMENTS_DISABLED
- DISABLED
- when Katello::Candlepin::Consumer::ENTITLEMENTS_VALID
- VALID
- when Katello::Candlepin::Consumer::ENTITLEMENTS_PARTIAL
- PARTIAL
- when Katello::Candlepin::Consumer::ENTITLEMENTS_INVALID
- INVALID
- when 'unsubscribed_hypervisor'
- UNSUBSCRIBED_HYPERVISOR
- else
- UNKNOWN
- end
- end
-
- def relevant?(_options = {})
- host.subscription_facet.try(:uuid)
- end
- end
-end
diff --git a/app/services/katello/candlepin/consumer.rb b/app/services/katello/candlepin/consumer.rb
index 4dd7ca5c6d7..3d8f0328f40 100644
--- a/app/services/katello/candlepin/consumer.rb
+++ b/app/services/katello/candlepin/consumer.rb
@@ -118,10 +118,6 @@ def compliance_reasons
self.class.friendly_compliance_reasons(Resources::Candlepin::Consumer.compliance(uuid)['reasons'])
end
- def system_purpose
- @system_purpose ||= Katello::Candlepin::SystemPurpose.new(purpose_compliance)
- end
-
def entitlements?
# use cahced consumer_attributes if possible
count = @consumer_attributes.try(:[], 'entitlementCount')
diff --git a/app/services/katello/candlepin/event_handler.rb b/app/services/katello/candlepin/event_handler.rb
index fa4d073c7f5..a9df69163c4 100644
--- a/app/services/katello/candlepin/event_handler.rb
+++ b/app/services/katello/candlepin/event_handler.rb
@@ -26,9 +26,9 @@ def handle(message)
when /pool\.deleted/
message_handler.delete_pool
when /^compliance\.created/
- reindex_subscription_status
+ event_no_longer_handled
when /system_purpose_compliance\.created/
- reindex_purpose_status
+ event_no_longer_handled
when /owner_content_access_mode\.modified/
message_handler.handle_content_access_mode_modified
end
@@ -37,31 +37,12 @@ def handle(message)
private
- def subscription_facet
- message_handler.subscription_facet
+ def event_no_longer_handled
+ @logger.error "Received #{message_handler.subject} event from Candlepin. Handling of this event is no longer supported."
end
- def reindex_subscription_status
- if message_handler.status.nil?
- @logger.debug "skip re-indexing of empty #{message_handler.subject} status #{message_handler.consumer_uuid}"
- return
- end
-
- reindex_consumer do
- subscription_facet.update_subscription_status(message_handler.status)
- subscription_facet.update_compliance_reasons(message_handler.reasons)
- end
- end
-
- def reindex_purpose_status
- reindex_consumer do
- return if subscription_facet.host.organization.simple_content_access?
- subscription_facet.update_purpose_status(role_status: message_handler.system_purpose.role_status,
- usage_status: message_handler.system_purpose.usage_status,
- addons_status: message_handler.system_purpose.addons_status,
- sla_status: message_handler.system_purpose.sla_status,
- purpose_status: message_handler.system_purpose.overall_status)
- end
+ def subscription_facet
+ message_handler.subscription_facet
end
def reindex_consumer
diff --git a/app/services/katello/candlepin/message_handler.rb b/app/services/katello/candlepin/message_handler.rb
index d7a072dd247..1fbeb4e042e 100644
--- a/app/services/katello/candlepin/message_handler.rb
+++ b/app/services/katello/candlepin/message_handler.rb
@@ -42,13 +42,6 @@ def consumer_uuid
content['consumerUuid']
end
- def system_purpose
- if subject == 'system_purpose_compliance.created' && @system_purpose.nil?
- @system_purpose = Katello::Candlepin::SystemPurpose.new(event_data)
- end
- @system_purpose
- end
-
def pool_id
if subject == 'pool.created' || subject == 'pool.deleted'
content['entityId']
@@ -105,21 +98,8 @@ def handle_content_access_mode_modified
end
org = ::Organization.find_by!(label: owner['key'])
- hosts = org.hosts
-
- if event_data['contentAccessMode'] == 'org_environment'
- Katello::HostStatusManager.clear_syspurpose_status(hosts)
- Katello::HostStatusManager.update_subscription_status_to_sca(hosts)
- elsif event_data['contentAccessMode'] == 'entitlement'
- cp_consumer_uuids = hosts.joins(:subscription_facet).pluck("#{Katello::Host::SubscriptionFacet.table_name}.uuid")
- cp_consumer_uuids.each do |uuid|
- Katello::Resources::Candlepin::Consumer.compliance(uuid)
- Katello::Resources::Candlepin::Consumer.purpose_compliance(uuid)
- rescue => e
- Rails.logger.error("Error encountered while fetching compliance for consumer #{uuid}: #{e.message}")
- end
- end
+ Rails.logger.error "Received content_access_mode_modified event for org #{org.label}. This event is no longer supported."
org.simple_content_access?(cached: false)
end
diff --git a/app/services/katello/candlepin/system_purpose.rb b/app/services/katello/candlepin/system_purpose.rb
deleted file mode 100644
index 62eb8087711..00000000000
--- a/app/services/katello/candlepin/system_purpose.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-module Katello
- module Candlepin
- class SystemPurpose
- attr_reader :compliance
-
- # the purpose compliance of a consumer and via event queue
- # are in the same format so we can parse them identically
- def initialize(purpose_compliance)
- @compliance = purpose_compliance
- end
-
- def overall_status
- if compliance['status'] == 'not specified'
- :not_specified
- elsif compliance['status'] == 'matched'
- :matched
- elsif compliance['status'] == 'mismatched'
- :mismatched
- end
- end
-
- def sla_status
- purpose_status(compliance['compliantSLA'], compliance['nonCompliantSLA'])
- end
-
- def role_status
- purpose_status(compliance['compliantRole'], compliance['nonCompliantRole'])
- end
-
- def usage_status
- purpose_status(compliance['compliantUsage'], compliance['nonCompliantUsage'])
- end
-
- def addons_status
- purpose_status(compliance['compliantAddons'], compliance['nonCompliantAddons'])
- end
-
- def purpose_status(compliant, noncompliant)
- if (noncompliant.nil? || noncompliant.try(:empty?)) && compliant.empty?
- :not_specified
- elsif noncompliant.nil? || noncompliant.try(:empty?)
- :matched
- elsif noncompliant.present?
- :mismatched
- end
- end
- end
- end
-end
diff --git a/app/services/katello/host_status_manager.rb b/app/services/katello/host_status_manager.rb
index 343ee458cbf..d64667e51a7 100644
--- a/app/services/katello/host_status_manager.rb
+++ b/app/services/katello/host_status_manager.rb
@@ -2,29 +2,7 @@ module Katello
class HostStatusManager
STATUSES = [
Katello::ErrataStatus,
- Katello::SubscriptionStatus,
- Katello::PurposeSlaStatus,
- Katello::PurposeRoleStatus,
- Katello::PurposeUsageStatus,
- Katello::PurposeAddonsStatus,
- Katello::PurposeStatus,
Katello::RhelLifecycleStatus,
Katello::TraceStatus].freeze
-
- PURPOSE_STATUS = [
- Katello::PurposeStatus,
- Katello::PurposeAddonsStatus,
- Katello::PurposeRoleStatus,
- Katello::PurposeSlaStatus,
- Katello::PurposeUsageStatus].freeze
-
- def self.update_subscription_status_to_sca(hosts)
- HostStatus::Status.where(host: hosts, type: Katello::SubscriptionStatus.to_s).update(status: Katello::SubscriptionStatus::DISABLED)
- end
-
- def self.clear_syspurpose_status(hosts)
- host_purpose = HostStatus::Status.where(type: ::Katello::HostStatusManager::PURPOSE_STATUS.map(&:to_s)).where('host_id in (?)', hosts.pluck(:id))
- host_purpose.destroy_all
- end
end
end
diff --git a/app/services/katello/registration_manager.rb b/app/services/katello/registration_manager.rb
index 29ce57a6865..815dcc92f7d 100644
--- a/app/services/katello/registration_manager.rb
+++ b/app/services/katello/registration_manager.rb
@@ -148,7 +148,7 @@ def unregister_host(host, options = {})
end
end
- def register_host(host, consumer_params, content_view_environments, activation_keys = []) # rubocop:disable Metrics/MethodLength
+ def register_host(host, consumer_params, content_view_environments, activation_keys = [])
new_host = host.new_record?
unless new_host
host.save!
@@ -172,7 +172,6 @@ def register_host(host, consumer_params, content_view_environments, activation_k
host.content_facet.cves_changed = false # prevent backend_update_needed from triggering an update on a nonexistent consumer
host.subscription_facet = populate_subscription_facet(host, activation_keys, consumer_params, host_uuid)
host.save! # the host has content and subscription facets at this point
- create_initial_subscription_status(host)
User.as_anonymous_admin do
begin
@@ -219,10 +218,6 @@ def remove_partially_registered_new_host(host)
destroy_host_record(host.id)
end
- def create_initial_subscription_status(host)
- host.subscription_facet.update_subscription_status(::Katello::SubscriptionStatus::UNKNOWN)
- end
-
def create_in_candlepin(host, content_view_environments, consumer_params, activation_keys)
# if CP fails, nothing to clean up yet w.r.t. backend services
cp_create = ::Katello::Resources::Candlepin::Consumer.create(content_view_environments.map(&:cp_id), consumer_params, activation_keys.map(&:cp_name), host.organization)
@@ -243,7 +238,6 @@ def finalize_registration(host)
host.subscription_facet.save!
host.refresh_statuses([
::Katello::ErrataStatus,
- ::Katello::SubscriptionStatus,
::Katello::RhelLifecycleStatus
])
end
@@ -314,12 +308,6 @@ def remove_host_artifacts(host, clear_content_facet: true)
end
host.get_status(::Katello::ErrataStatus).destroy
- host.get_status(::Katello::PurposeSlaStatus).destroy
- host.get_status(::Katello::PurposeRoleStatus).destroy
- host.get_status(::Katello::PurposeUsageStatus).destroy
- host.get_status(::Katello::PurposeAddonsStatus).destroy
- host.get_status(::Katello::PurposeStatus).destroy
- host.get_status(::Katello::SubscriptionStatus).destroy
host.get_status(::Katello::TraceStatus).destroy
host.installed_packages.delete_all
diff --git a/app/views/dashboard/_subscription_status_widget.html.erb b/app/views/dashboard/_subscription_status_widget.html.erb
deleted file mode 100644
index d137b33e4b0..00000000000
--- a/app/views/dashboard/_subscription_status_widget.html.erb
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-<% unless Organization.current.present? %>
- <%= _("Please select an organization to view subscription totals.") %>
-<% else %>
- <% subscriptions = Katello::Subscription.in_organization([Organization.current]).includes(:pools) %>
- <% total_active_subscriptions = Organization.current.active_pools_count %>
- <% total_expiring_subscriptions = subscriptions.select(&:expiring_soon?).count %>
- <% total_recently_expired_subscriptions = subscriptions.select(&:recently_expired?).count %>
-
-
-
-
- <%= _("Subscription Status") %> |
- <%= _("Count") %> |
-
-
-
-
- <%= _("Active Subscriptions") %> |
- <%= total_active_subscriptions %> |
-
-
- <%= _("Subscriptions Expiring in 120 Days") %> |
- <%= total_expiring_subscriptions %> |
-
-
- <%= _("Recently Expired Subscriptions") %> |
- <%= total_recently_expired_subscriptions %> |
-
-
-
-<% end %>
-
-
diff --git a/app/views/dashboard/_subscription_widget.html.erb b/app/views/dashboard/_subscription_widget.html.erb
deleted file mode 100644
index 5ae7fc2d232..00000000000
--- a/app/views/dashboard/_subscription_widget.html.erb
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
-<% if Organization.current.blank? %>
- <%= _("Please select an organization to view subscription status.") %>
-<% else %>
- <% total_count = total_host_count() %>
- <% partial_consumer_count = partial_consumer_count() %>
- <% valid_consumer_count = valid_consumer_count()%>
- <% invalid_consumer_count = invalid_consumer_count()%>
- <% unknown_consumer_count = unknown_consumer_count() %>
- <% subscription_status_url = '/content_hosts?search='%>
- <% registered_subscription_url = subscription_status_url + ERB::Util.url_encode('subscription_status = ') %>
- <% unknown_search_url = registered_subscription_url + 'unknown or (null? subscription_uuid)' %>
-
-
-
-
- |
- <%= _("Count") %> |
-
-
-
-
-
- <%= link_to("#{registered_subscription_url}" + 'invalid') do %>
- <%= _("Invalid") %>
- <% end %>
- |
-
- <%= link_to( "#{invalid_consumer_count}", "#{registered_subscription_url}" + 'invalid')%>
- |
-
-
-
- <%= link_to("#{registered_subscription_url}" + 'partial') do %>
- <%= _("Partial") %>
- <% end %>
- |
-
- <%= link_to( "#{partial_consumer_count}", "#{registered_subscription_url}" + 'partial')%>
- |
-
-
-
- <%= link_to("#{registered_subscription_url}" + 'valid') do %>
- <%= _("Valid") %>
- <% end %>
- |
-
- <%= link_to( "#{valid_consumer_count}", "#{registered_subscription_url}" + 'valid')%>
- |
-
-
-
- <%= link_to("#{registered_subscription_url}" + 'unsubscribed_hypervisor') do %>
- <%= _("Unsubscribed Hypervisor") %>
- <% end %>
- |
-
- <%= link_to( "#{unsubscribed_hypervisor_count}", "#{registered_subscription_url}" + 'unsubscribed_hypervisor')%>
- |
-
-
-
- <%= link_to(unknown_search_url) do %>
- <%= _("Unknown or Unregistered") %>
- <% end %>
- |
-
- <%= link_to("#{unknown_consumer_count}", unknown_search_url)%>
- |
-
-
-
- <%= link_to("Total Content Hosts", '/content_hosts')%>
- |
-
- <%= link_to( "#{total_count}", '/content_hosts')%>
- |
-
-
-
-<% end %>
diff --git a/app/views/katello/api/v2/subscription_facet/base_with_root.json.rabl b/app/views/katello/api/v2/subscription_facet/base_with_root.json.rabl
index 6aade153fd0..ecf9976b418 100644
--- a/app/views/katello/api/v2/subscription_facet/base_with_root.json.rabl
+++ b/app/views/katello/api/v2/subscription_facet/base_with_root.json.rabl
@@ -1,6 +1,3 @@
child :subscription_facet => :subscription_facet_attributes do
extends 'katello/api/v2/subscription_facet/base'
end
-
-attributes :subscription_status, :subscription_status_label, :subscription_global_status,
- :if => @object.get_status(Katello::SubscriptionStatus).relevant?
diff --git a/db/migrate/20200818192230_update_system_purpose_status.rb b/db/migrate/20200818192230_update_system_purpose_status.rb
index 76cc7a050c6..54871b3565b 100644
--- a/db/migrate/20200818192230_update_system_purpose_status.rb
+++ b/db/migrate/20200818192230_update_system_purpose_status.rb
@@ -1,12 +1,18 @@
class UpdateSystemPurposeStatus < ActiveRecord::Migration[6.0]
def change
- purpose_types = Katello::HostStatusManager::PURPOSE_STATUS.map(&:to_s)
+ purpose_types = [
+ "Katello::PurposeStatus",
+ "Katello::PurposeAddonsStatus",
+ "Katello::PurposeRoleStatus",
+ "Katello::PurposeSlaStatus",
+ "Katello::PurposeUsageStatus"
+ ]
# load both sets of host statuses and *then* update them to make sure we update the correct statuses
unknown_statuses = ::HostStatus::Status.where(type: purpose_types, status: 2).pluck(:id)
matched_statuses = ::HostStatus::Status.where(type: purpose_types, status: 0).pluck(:id)
- ::HostStatus::Status.where(id: unknown_statuses).update_all(status: Katello::PurposeStatus::UNKNOWN) # 2 => 0
- ::HostStatus::Status.where(id: matched_statuses).update_all(status: Katello::PurposeStatus::MATCHED) # 0 => 2
+ ::HostStatus::Status.where(id: unknown_statuses).update_all(status: 0) # 2 => 0
+ ::HostStatus::Status.where(id: matched_statuses).update_all(status: 2) # 0 => 2
end
end
diff --git a/db/migrate/20240207191223_remove_entitlement_mode_host_statuses.rb b/db/migrate/20240207191223_remove_entitlement_mode_host_statuses.rb
new file mode 100644
index 00000000000..016dd7fdfd8
--- /dev/null
+++ b/db/migrate/20240207191223_remove_entitlement_mode_host_statuses.rb
@@ -0,0 +1,30 @@
+class RemoveEntitlementModeHostStatuses < ActiveRecord::Migration[6.1]
+ class FakeTablePreference < ApplicationRecord
+ self.table_name = 'table_preferences'
+ serialize :columns
+ end
+
+ def up
+ obsolete_statuses = [
+ "Katello::SubscriptionStatus",
+ "Katello::PurposeStatus",
+ "Katello::PurposeAddonsStatus",
+ "Katello::PurposeRoleStatus",
+ "Katello::PurposeSlaStatus",
+ "Katello::PurposeUsageStatus"
+ ]
+
+ ::HostStatus::Status.where(type: obsolete_statuses).delete_all
+
+ FakeTablePreference.where(name: "hosts").each do |table_preference|
+ next unless table_preference.columns.include?("subscription_status")
+ new_columns = table_preference.columns - ["subscription_status"]
+ if new_columns.present?
+ table_preference.columns = new_columns
+ table_preference.save(validate: false)
+ else
+ table_preference.destroy
+ end
+ end
+ end
+end
diff --git a/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-associations-content-hosts.html b/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-associations-content-hosts.html
index 58b3ba722da..9263308c39e 100644
--- a/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-associations-content-hosts.html
+++ b/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-associations-content-hosts.html
@@ -33,10 +33,6 @@
{{ host.name }}
-
-
-
- |
{{ host.content_facet_attributes.lifecycle_environment.name }} |
{{ host.content_facet_attributes.content_view.name || "" }} |
{{ host.subscription_facet_attributes.service_level }} |
diff --git a/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js b/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
index a681bec5f68..4a2ddcb0754 100644
--- a/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
+++ b/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
@@ -38,16 +38,6 @@ angular.module('Bastion.content-hosts').service('ContentHostsHelper',
return icons[globalStatus];
};
- this.getHostPurposeStatusIcon = function (statusCode) {
- var code = parseInt(statusCode);
-
- if (code === 2) { // matched
- return 'pficon pficon-ok';
- } else if (code === 1) { // mismatched
- return 'pficon pficon-warning-triangle-o';
- }
- };
-
this.rebootRequired = function(traces) {
return traces.some(function(trace) {
return trace.reboot_required;
diff --git a/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js b/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js
index 6c70ce38155..8c25a20c836 100644
--- a/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js
+++ b/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js
@@ -24,7 +24,6 @@ angular.module('Bastion.content-hosts').controller('ContentHostDetailsController
$scope.menuExpander = MenuExpander;
$scope.getHostStatusIcon = ContentHostsHelper.getHostStatusIcon;
- $scope.getHostPurposeStatusIcon = ContentHostsHelper.getHostPurposeStatusIcon;
$scope.organization = Organization.get({id: CurrentOrganization}, function(org) {
$scope.purposeAddonsCount += org.system_purposes.addons.length;
diff --git a/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html b/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html
index dc7b69a2103..d9d432fade3 100644
--- a/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html
+++ b/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html
@@ -74,12 +74,6 @@ Basic Information
Subscriptions
- - Subscription Status
- -
-
- {{ host.subscription_status_label }}
-
-
- Details
-
@@ -104,16 +98,9 @@ Subscriptions
- - System Purpose Status
- -
-
- {{ host.purpose_status_label }}
-
- Service Level (SLA)
- Subscriptions
- Usage Type
- Subscriptions
- Role
- Subscriptions
- Add ons
- Subscription Details
- - Status
- -
-
- {{ host.subscription_status_label | translate }}
-
- Details
-
diff --git a/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html b/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html
index fc4622b05eb..113b2daa7f8 100644
--- a/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html
+++ b/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html
@@ -79,9 +79,6 @@
Content Hosts
Name |
-
- {{ 'Subscription Status' | translate }}
- |
Installable Updates
|
@@ -105,10 +102,6 @@ Content Hosts
{{ host.display_name }}
-
-
-
- |
diff --git a/engines/bastion_katello/test/content-hosts/content-hosts-helper.service.test.js b/engines/bastion_katello/test/content-hosts/content-hosts-helper.service.test.js
index 26478e642a1..5dc88f8436d 100644
--- a/engines/bastion_katello/test/content-hosts/content-hosts-helper.service.test.js
+++ b/engines/bastion_katello/test/content-hosts/content-hosts-helper.service.test.js
@@ -10,17 +10,6 @@ describe('Controller: ContentHostsController', function() {
ContentHostsHelper = $injector.get('ContentHostsHelper');
}));
- it("provides a way to get the status icon for system purpose on a host.", function() {
- expect(ContentHostsHelper.getHostPurposeStatusIcon(2)).toBe("pficon pficon-ok");
- expect(ContentHostsHelper.getHostPurposeStatusIcon(1)).toBe("pficon pficon-warning-triangle-o");
- });
-
- it("provides a way to get the global status color.", function() {
- expect(ContentHostsHelper.getHostStatusIcon(0)).toBe(greenStatus);
- expect(ContentHostsHelper.getHostStatusIcon(1)).toBe(yellowStatus);
- expect(ContentHostsHelper.getHostStatusIcon(2)).toBe(redStatus);
- });
-
it('should convert Memory to GB', function() {
expect(ContentHostsHelper.convertMemToGB(1020120)).toBe('0.97')
expect(ContentHostsHelper.convertMemToGB('5946304')).toBe('5.67')
diff --git a/lib/katello/engine.rb b/lib/katello/engine.rb
index 7c452b9e2ef..021774d449d 100644
--- a/lib/katello/engine.rb
+++ b/lib/katello/engine.rb
@@ -201,7 +201,6 @@ class Engine < ::Rails::Engine
::Api::V2::RegistrationCommandsController.include Katello::Concerns::Api::V2::RegistrationCommandsControllerExtensions
::AuditSearch::ClassMethods.prepend Katello::Concerns::AuditSearch
- ::Widget.singleton_class.prepend Katello::Concerns::WidgetExtensions::ClassMethods
if ::Katello.with_remote_execution?
::RemoteExecutionProxySelector.prepend Katello::Concerns::RemoteExecutionProxySelectorExtensions
diff --git a/lib/katello/plugin.rb b/lib/katello/plugin.rb
index 2370486f791..9f5099c1620 100644
--- a/lib/katello/plugin.rb
+++ b/lib/katello/plugin.rb
@@ -246,8 +246,6 @@
widget 'errata_widget', :name => 'Latest Errata', :sizey => 1, :sizex => 6
widget 'content_views_widget', :name => 'Content Views', :sizey => 1, :sizex => 6
widget 'sync_widget', :name => 'Sync Overview', :sizey => 1, :sizex => 6
- widget 'subscription_widget', :name => 'Host Subscription Status', :sizey => 1, :sizex => 6
- widget 'subscription_status_widget', :name => 'Subscription Status', :sizey => 1, :sizex => 6
widget 'host_collection_widget', :name => 'Host Collections', :sizey => 1, :sizex => 6
extend_page("smart_proxies/show") do |context|
@@ -270,9 +268,6 @@
common_class = 'hidden-tablet hidden-xs ellipsis'
use_pagelet :hosts_table_column_header, :name
use_pagelet :hosts_table_column_content, :name
- add_pagelet :hosts_table_column_header, key: :subscription_status, label: _('Subscription status'), sortable: true, class: common_class, width: '10%', export_key: 'subscription_global_status'
- add_pagelet :hosts_table_column_content, key: :subscription_status, class: common_class, callback: ->(host) { host_status_icon(host.subscription_global_status) }
-
add_pagelet :hosts_table_column_header, key: :rhel_lifecycle_status, label: _('RHEL Lifecycle status'), sortable: true, class: common_class, width: '10%', export_key: 'rhel_lifecycle_status'
add_pagelet :hosts_table_column_content, key: :rhel_lifecycle_status, class: common_class, callback: ->(host) { host_status_icon(host.rhel_lifecycle_global_status) }
diff --git a/lib/katello/tasks/unify_hosts.rake b/lib/katello/tasks/unify_hosts.rake
index 0975a247bca..a7debc2b447 100644
--- a/lib/katello/tasks/unify_hosts.rake
+++ b/lib/katello/tasks/unify_hosts.rake
@@ -130,7 +130,6 @@ namespace :katello do
if sub_facet
sub_facet.host = provisioning_host
sub_facet.save!
- sub_facet.update_subscription_status
end
provisioning_host.name = provisioning_host.name.downcase
diff --git a/test/actions/katello/host/hypervisors_update_test.rb b/test/actions/katello/host/hypervisors_update_test.rb
index bb78a3a775e..6cde027e89e 100644
--- a/test/actions/katello/host/hypervisors_update_test.rb
+++ b/test/actions/katello/host/hypervisors_update_test.rb
@@ -34,7 +34,6 @@ def setup
}.with_indifferent_access
@consumer = {
uuid: @host.subscription_facet.uuid,
- entitlementStatus: Katello::SubscriptionStatus::UNKNOWN,
guestIds: ['test-id-1'],
entitlementCount: 0,
facts: @facts,
diff --git a/test/controllers/foreman/dashboard_controller_test.rb b/test/controllers/foreman/dashboard_controller_test.rb
deleted file mode 100644
index 77972272edb..00000000000
--- a/test/controllers/foreman/dashboard_controller_test.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-require 'katello_test_helper'
-class DashboardControllerTest < ActionController::TestCase
- def setup
- setup_controller_defaults(false, false)
- login_user(User.find(users(:admin).id))
- Dashboard::Manager.reset_user_to_default(User.current)
- models
- end
-
- def test_show_subscription_widget
- id = User.current.widgets.find_by(:template => 'subscription_widget').id
- get :show, params: {id: id}
-
- assert_response :success
- end
-end
diff --git a/test/controllers/foreman/hosts_controller_test.rb b/test/controllers/foreman/hosts_controller_test.rb
index 6d403b34ac4..98d5608582b 100644
--- a/test/controllers/foreman/hosts_controller_test.rb
+++ b/test/controllers/foreman/hosts_controller_test.rb
@@ -83,7 +83,6 @@ def test_csv_export
expected_columns = [
'Name',
- 'Subscription Status',
'Installable Updates - Security',
'Installable Updates - Bug Fixes',
'Installable Updates - Enhancements',
diff --git a/test/helpers/dashboard_helper_test.rb b/test/helpers/dashboard_helper_test.rb
index de39cf09418..3c79049b9f7 100644
--- a/test/helpers/dashboard_helper_test.rb
+++ b/test/helpers/dashboard_helper_test.rb
@@ -23,60 +23,4 @@ def test_total_host_count
refute total.nil?
assert_equal 1, total
end
-
- def test_partial_consumer_count
- @host.subscription_facet.update_subscription_status('partial')
- partial = partial_consumer_count
- assert_equal 1, partial
- end
-
- def test_valid_consumer_count
- @host.subscription_facet.update_subscription_status('valid')
- valid = valid_consumer_count
- assert_equal 1, valid
- end
-
- def test_invalid_consumer_count
- @host.subscription_facet.update_subscription_status('invalid')
- invalid = invalid_consumer_count
- assert_equal 1, invalid
- end
-
- def test_unknown_consumer_count
- @host.subscription_facet.update_subscription_status('unknown')
- unknown = unknown_consumer_count
- assert_equal 1, unknown
- end
-
- def test_unregistered_consumer_count
- @host.subscription_facet.update!(uuid: nil)
- unknown = unknown_consumer_count
- assert_equal 1, unknown
- end
-
- def test_unsubscribed_hypervisor_consumer_count
- @host.subscription_facet.update_subscription_status('unsubscribed_hypervisor')
- unknown = unsubscribed_hypervisor_count
- assert_equal 1, unknown
- end
-
- def test_partial_consumer_count_nil
- partial = partial_consumer_count
- refute partial.nil?
- end
-
- def test_valid_consumer_count_nil
- valid = valid_consumer_count
- refute valid.nil?
- end
-
- def test_invalid_consumer_count_nil
- invalid = invalid_consumer_count
- refute invalid.nil?
- end
-
- def test_unknown_consumer_count_nil
- unknown = unknown_consumer_count
- refute unknown.nil?
- end
end
diff --git a/test/models/concerns/host_managed_extensions_test.rb b/test/models/concerns/host_managed_extensions_test.rb
index 2e1273912ef..b6b05af85f8 100644
--- a/test/models/concerns/host_managed_extensions_test.rb
+++ b/test/models/concerns/host_managed_extensions_test.rb
@@ -46,16 +46,6 @@ def test_full_text_search
refute_includes found, other_host
end
- def test_host_status_reset
- host = FactoryBot.create(:host)
- host.host_statuses.delete_all
- Katello::SubscriptionStatus.create!(host: host, :status => Katello::SubscriptionStatus::VALID)
- host.reload
- assert_equal Katello::SubscriptionStatus::VALID, host.host_statuses.first.status
- host.reset_katello_status
- assert_equal Katello::SubscriptionStatus::UNKNOWN, host.host_statuses.first.status
- end
-
def test_unknown_statuses_exists_in_katello_status_classes
::Katello::HostStatusManager::STATUSES.each do |status_class|
assert status_class.const_defined?(:UNKNOWN), "Checking #{status_class.name}"
diff --git a/test/models/host/subscription_facet_test.rb b/test/models/host/subscription_facet_test.rb
index 09d24fe92ec..338680c2592 100644
--- a/test/models/host/subscription_facet_test.rb
+++ b/test/models/host/subscription_facet_test.rb
@@ -73,41 +73,6 @@ def test_update_from_consumer_attributes
assert_empty subscription_facet.purpose_usage
assert_empty subscription_facet.purpose_addons
end
-
- def test_purpose_status_search
- searches = {
- Katello::PurposeSlaStatus => "sla_status",
- Katello::PurposeAddonsStatus => "addons_status",
- Katello::PurposeRoleStatus => "role_status",
- Katello::PurposeUsageStatus => "usage_status",
- Katello::PurposeStatus => "purpose_status"
- }
-
- searches.each do |status_class, query|
- status = status_class.new(host: host)
- status.status = Katello::PurposeStatus::MISMATCHED
- status.reported_at = Time.now
- status.save!
-
- assert_includes ::Host::Managed.search_for("#{query} = mismatched"), host
- end
- end
-
- def test_update_purpose_status
- host.organization.stubs(:simple_content_access?).returns(false)
- subscription_facet.update_purpose_status(sla_status: :mismatched,
- role_status: :unknown,
- usage_status: :not_specified,
- addons_status: :matched,
- purpose_status: :matched
- )
-
- assert_equal host.purpose_sla_status, Katello::PurposeStatus::MISMATCHED
- assert_equal host.purpose_role_status, Katello::PurposeStatus::UNKNOWN
- assert_equal host.purpose_usage_status, Katello::PurposeStatus::NOT_SPECIFIED
- assert_equal host.purpose_addons_status, Katello::PurposeStatus::MATCHED
- assert_equal host.purpose_status, Katello::PurposeStatus::MATCHED
- end
end
class SubscriptionFacetTest < SubscriptionFacetBase
@@ -283,15 +248,6 @@ def test_update_foreman_facts_without_distribution_version
assert_equal "6", host.operatingsystem.minor
end
- def test_subscription_status
- status = Katello::SubscriptionStatus.new(:host => host)
- status.status = Katello::SubscriptionStatus::INVALID
- status.reported_at = Time.now
- status.save!
-
- assert_includes ::Host::Managed.search_for("subscription_status = invalid"), host
- end
-
def test_remove_subscriptions
pool = katello_pools(:pool_one)
pq = [PoolWithQuantities.new(pool, [1])]
diff --git a/test/models/purpose_status_test.rb b/test/models/purpose_status_test.rb
deleted file mode 100644
index f75c30067e3..00000000000
--- a/test/models/purpose_status_test.rb
+++ /dev/null
@@ -1,91 +0,0 @@
-require 'katello_test_helper'
-
-module Katello
- module PurposeStatusTests
- def test_status_unknown
- purpose_mock = mock(purpose_method => :inexistent)
- Katello::Candlepin::Consumer.any_instance.expects(:system_purpose).returns(purpose_mock)
-
- assert_equal Katello::PurposeStatus::UNKNOWN, status.to_status
- assert_equal 'Unknown', status.to_label
- end
-
- def test_status_mismatched
- purpose_mock = mock(purpose_method => :mismatched)
- Katello::Candlepin::Consumer.any_instance.expects(:system_purpose).returns(purpose_mock)
- status.status = status.to_status
-
- assert_equal Katello::PurposeStatus::MISMATCHED, status.status
- assert_equal 'Mismatched', status.to_label
- end
-
- def test_status_not_specified
- purpose_mock = mock(purpose_method => :not_specified)
- Katello::Candlepin::Consumer.any_instance.expects(:system_purpose).returns(purpose_mock)
- status.status = status.to_status
-
- assert_equal Katello::PurposeStatus::NOT_SPECIFIED, status.status
- assert_equal 'Not specified', status.to_label
- end
-
- def test_status_matched
- purpose_mock = mock(purpose_method => :matched)
- Katello::Candlepin::Consumer.any_instance.expects(:system_purpose).returns(purpose_mock)
- status.status = status.to_status
-
- assert_equal Katello::PurposeStatus::MATCHED, status.status
- assert_equal 'Matched', status.to_label
- end
-
- def test_status_override
- assert_equal Katello::PurposeStatus::MISMATCHED, status.to_status(status_override: :mismatched)
- assert_equal Katello::PurposeStatus::MATCHED, status.to_status(status_override: :matched)
- assert_equal Katello::PurposeStatus::NOT_SPECIFIED, status.to_status(status_override: :not_specified)
- assert_equal Katello::PurposeStatus::UNKNOWN, status.to_status(status_override: :inexistent)
- end
- end
-
- class PurposeStatusTest < ActiveSupport::TestCase
- include PurposeStatusTests
-
- let(:host) { FactoryBot.create(:host, :with_subscription) }
- let(:status) { host.get_status(Katello::PurposeStatus) }
- let(:purpose_method) { :overall_status }
-
- def test_global_status
- assert status.to_global
- end
- end
-
- class PurposeSlaStatusTest < ActiveSupport::TestCase
- include PurposeStatusTests
-
- let(:host) { FactoryBot.create(:host, :with_subscription) }
- let(:status) { host.get_status(Katello::PurposeSlaStatus) }
- let(:purpose_method) { :sla_status }
- end
-
- class PurposeUsageStatusTest < ActiveSupport::TestCase
- include PurposeStatusTests
-
- let(:host) { FactoryBot.create(:host, :with_subscription) }
- let(:status) { host.get_status(Katello::PurposeUsageStatus) }
- let(:purpose_method) { :usage_status }
- end
-
- class PurposeRoleStatusTest < ActiveSupport::TestCase
- include PurposeStatusTests
-
- let(:host) { FactoryBot.create(:host, :with_subscription) }
- let(:status) { host.get_status(Katello::PurposeRoleStatus) }
- let(:purpose_method) { :role_status }
- end
-
- class PurposeAddonsStatusTest < ActiveSupport::TestCase
- include PurposeStatusTests
-
- let(:host) { FactoryBot.create(:host, :with_subscription) }
- let(:status) { host.get_status(Katello::PurposeAddonsStatus) }
- let(:purpose_method) { :addons_status }
- end
-end
diff --git a/test/models/subscription_status_test.rb b/test/models/subscription_status_test.rb
deleted file mode 100644
index 889c54ea0f0..00000000000
--- a/test/models/subscription_status_test.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-require 'katello_test_helper'
-
-module Katello
- class SubscriptionStatusTest < ActiveSupport::TestCase
- let(:host) do
- FactoryBot.build(:host, :with_subscription, :organization => get_organization)
- end
-
- let(:status) { host.get_status(Katello::SubscriptionStatus) }
-
- def setup
- ::Organization.any_instance.stubs(:simple_content_access?).returns(false)
- end
-
- def stub_status(status)
- Katello::Candlepin::Consumer.any_instance.stubs(:entitlement_status).returns(status)
- end
-
- def test_get_status
- assert host.get_status(Katello::SubscriptionStatus)
- end
-
- def test_to_status_valid
- stub_status(Katello::Candlepin::Consumer::ENTITLEMENTS_VALID)
- assert_equal Katello::SubscriptionStatus::VALID, status.to_status
- end
-
- def test_to_status_disabled
- stub_status(Katello::Candlepin::Consumer::ENTITLEMENTS_DISABLED)
- assert_equal Katello::SubscriptionStatus::DISABLED, status.to_status
- end
-
- def test_to_status_partial
- stub_status(Katello::Candlepin::Consumer::ENTITLEMENTS_PARTIAL)
- assert_equal Katello::SubscriptionStatus::PARTIAL, status.to_status
- end
-
- def test_to_status_invalid
- stub_status(Katello::Candlepin::Consumer::ENTITLEMENTS_INVALID)
- assert_equal Katello::SubscriptionStatus::INVALID, status.to_status
- end
-
- def test_to_status_unsubscribed_hypervisor
- host.subscription_facet.stubs(:unsubscribed_hypervisor?).returns(true)
- assert_equal Katello::SubscriptionStatus::UNSUBSCRIBED_HYPERVISOR, status.to_status
- end
-
- def test_sca_enabled
- ::Organization.any_instance.stubs(:simple_content_access?).returns(true)
- assert_equal Katello::SubscriptionStatus::DISABLED, status.to_status
- end
-
- def test_no_subscription_facet
- assert_equal Katello::SubscriptionStatus::UNKNOWN, FactoryBot.build(:host).get_status(Katello::SubscriptionStatus).to_status
- end
-
- def test_to_global
- stub_status(Katello::Candlepin::Consumer::ENTITLEMENTS_PARTIAL)
- status.status = Katello::SubscriptionStatus::PARTIAL
- assert_equal HostStatus::Global::WARN, status.to_global
- end
-
- def test_update
- host.save!
- stub_status(Katello::Candlepin::Consumer::ENTITLEMENTS_VALID)
- assert status.refresh!
- end
- end
-end
diff --git a/test/services/candlepin/message_handler_test.rb b/test/services/candlepin/message_handler_test.rb
index f0358eccc54..0ca42f515e7 100644
--- a/test/services/candlepin/message_handler_test.rb
+++ b/test/services/candlepin/message_handler_test.rb
@@ -21,18 +21,6 @@ def setup
end
end
- class SystemPurposeComplianceCreatedTest < MessageHandlerTestBase
- let(:event_name) { 'system_purpose_compliance.created' }
-
- def test_system_purpose
- assert_equal handler.system_purpose.overall_status, :mismatched
- assert_equal handler.system_purpose.sla_status, :mismatched
- assert_equal handler.system_purpose.role_status, :not_specified
- assert_equal handler.system_purpose.usage_status, :not_specified
- assert_equal handler.system_purpose.addons_status, :not_specified
- end
- end
-
class ComplianceCreatedTest < MessageHandlerTestBase
let(:event_name) { 'compliance.created' }
@@ -142,24 +130,9 @@ def setup
super
end
- def test_sca_enabled
- Katello::HostStatusManager.expects(:clear_syspurpose_status)
- Katello::HostStatusManager.expects(:update_subscription_status_to_sca)
- Organization.any_instance.expects(:simple_content_access?).with(cached: false)
-
- handler.handle_content_access_mode_modified
- end
-
- def test_sca_disabled
- Katello::HostStatusManager.expects(:clear_syspurpose_status).never
- Katello::HostStatusManager.expects(:update_subscription_status_to_sca).never
+ def test_content_access_mode_modified
Organization.any_instance.expects(:simple_content_access?).with(cached: false)
- handler.expects(:event_data).returns('contentAccessMode' => 'entitlement').twice
-
- @org.hosts.joins(:subscription_facet).count.times do
- Katello::Resources::Candlepin::Consumer.expects(:compliance)
- Katello::Resources::Candlepin::Consumer.expects(:purpose_compliance)
- end
+ Rails.logger.expects(:error).with("Received content_access_mode_modified event for org #{@org.label}. This event is no longer supported.")
handler.handle_content_access_mode_modified
end
diff --git a/test/services/katello/candlepin/event_handler_test.rb b/test/services/katello/candlepin/event_handler_test.rb
index 4cbd42d61dd..7cb105ca5a3 100644
--- a/test/services/katello/candlepin/event_handler_test.rb
+++ b/test/services/katello/candlepin/event_handler_test.rb
@@ -28,23 +28,6 @@ def message(subject, content = {})
let(:mymessage) do
message("compliance.created", 'eventData' => "{\"status\":\"invalid\"}")
end
-
- it 're-indexes the subscription status' do
- subscription_facet.expects(:update_subscription_status)
- subscription_facet.expects(:update_compliance_reasons)
- handler.handle(mymessage)
- end
- end
-
- describe 'handles system_purpose_compliance.created' do
- let(:mymessage) do
- message("system_purpose_compliance.created", 'eventData' => "{\"reasons\":[]}")
- end
-
- it 're-indexes the purpose status' do
- subscription_facet.expects(:update_purpose_status)
- handler.handle(mymessage)
- end
end
describe 'handles entitlement.created' do
diff --git a/test/services/katello/candlepin/system_purpose_test.rb b/test/services/katello/candlepin/system_purpose_test.rb
deleted file mode 100644
index f0a59bfe08e..00000000000
--- a/test/services/katello/candlepin/system_purpose_test.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-require 'katello_test_helper'
-
-module Katello
- module Candlepin
- class SystemPurposeTest < ActiveSupport::TestCase
- def setup
- @system_purpose = Katello::Candlepin::SystemPurpose.new({})
- end
-
- def test_purpose_status
- assert_equal :not_specified, @system_purpose.purpose_status(nil, nil)
- assert_equal :not_specified, @system_purpose.purpose_status({}, nil)
- assert_equal :not_specified, @system_purpose.purpose_status(nil, [])
-
- assert_equal :matched, @system_purpose.purpose_status({'compliantrole' => {}}, nil)
- assert_equal :matched, @system_purpose.purpose_status({'compliantaddon' => {}}, [])
-
- assert_equal :mismatched, @system_purpose.purpose_status(nil, 'noncompliant_role')
- assert_equal :mismatched, @system_purpose.purpose_status(nil, ['noncompliant_addon'])
- assert_equal :mismatched, @system_purpose.purpose_status({}, ['noncompliant_addon'])
- assert_equal :mismatched, @system_purpose.purpose_status({'compliant' => {}}, ['noncompliant_addon'])
- end
- end
- end
-end
diff --git a/test/services/katello/host_status_manager_test.rb b/test/services/katello/host_status_manager_test.rb
deleted file mode 100644
index 2fd6cc17a90..00000000000
--- a/test/services/katello/host_status_manager_test.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-require 'katello_test_helper'
-
-module Katello
- class HostStatusManagerTest < ActiveSupport::TestCase
- def setup
- @org = get_organization(:empty_organization)
- end
-
- def test_clear_syspurpose_status
- host = @org.hosts.first
-
- Katello::HostStatusManager::PURPOSE_STATUS.each do |status_class|
- HostStatus::Status.create(host: host, type: status_class.to_s)
- end
-
- assert_equal 5, host.host_statuses.count
-
- Katello::HostStatusManager.clear_syspurpose_status(@org.hosts)
-
- assert_equal 0, host.host_statuses.count
- end
-
- def test_update_subscription_status_to_sca
- host = @org.hosts.first
- sub_status = HostStatus::Status.create(host: host, type: Katello::SubscriptionStatus.to_s, status: Katello::SubscriptionStatus::INVALID)
-
- Katello::HostStatusManager.update_subscription_status_to_sca(@org.hosts)
-
- assert_equal Katello::SubscriptionStatus::DISABLED, sub_status.reload.status
- end
- end
-end
diff --git a/webpack/scenes/ContentViews/Delete/__tests__/affectedHosts.fixtures.json b/webpack/scenes/ContentViews/Delete/__tests__/affectedHosts.fixtures.json
index 7ca495c7497..74307d28249 100644
--- a/webpack/scenes/ContentViews/Delete/__tests__/affectedHosts.fixtures.json
+++ b/webpack/scenes/ContentViews/Delete/__tests__/affectedHosts.fixtures.json
@@ -77,18 +77,6 @@
"build_status_label": "Installed",
"errata_status": 0,
"errata_status_label": "All errata applied",
- "subscription_status": 5,
- "subscription_status_label": "Simple Content Access",
- "purpose_sla_status": 0,
- "purpose_sla_status_label": "Unknown",
- "purpose_role_status": 0,
- "purpose_role_status_label": "Unknown",
- "purpose_usage_status": 0,
- "purpose_usage_status_label": "Unknown",
- "purpose_addons_status": 0,
- "purpose_addons_status_label": "Unknown",
- "purpose_status": 0,
- "purpose_status_label": "Unknown",
"name": "affectedHost.example.com",
"id": 1,
"puppet_proxy_id": null,
@@ -134,7 +122,6 @@
"content_source": null,
"kickstart_repository": null
},
- "subscription_global_status": 0,
"subscription_facet_attributes": {
"id": 2,
"uuid": "457997e1-ac07-40e4-85b7-e382a3563e4a",
diff --git a/webpack/scenes/ContentViews/Details/Versions/BulkDelete/__tests__/hosts.fixtures.json b/webpack/scenes/ContentViews/Details/Versions/BulkDelete/__tests__/hosts.fixtures.json
index db095771c4f..91e663d2733 100644
--- a/webpack/scenes/ContentViews/Details/Versions/BulkDelete/__tests__/hosts.fixtures.json
+++ b/webpack/scenes/ContentViews/Details/Versions/BulkDelete/__tests__/hosts.fixtures.json
@@ -77,18 +77,6 @@
"build_status_label": "Installed",
"errata_status": 3,
"errata_status_label": "Security errata applicable",
- "subscription_status": 0,
- "subscription_status_label": "Fully entitled",
- "purpose_sla_status": 3,
- "purpose_sla_status_label": "Not Specified",
- "purpose_role_status": 3,
- "purpose_role_status_label": "Not Specified",
- "purpose_usage_status": 3,
- "purpose_usage_status_label": "Not Specified",
- "purpose_addons_status": 3,
- "purpose_addons_status_label": "Not Specified",
- "purpose_status": 3,
- "purpose_status_label": "Not Specified",
"name": "steve8.satellite.lab.eng.rdu2.redhat.com",
"id": 1,
"puppet_proxy_id": null,
@@ -138,7 +126,6 @@
},
"kickstart_repository": null
},
- "subscription_global_status": 0,
"subscription_facet_attributes": {
"id": 1,
"uuid": "435a8c86-0df4-4333-9d9f-82149c20612e",
diff --git a/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvAffectedHosts.fixture.json b/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvAffectedHosts.fixture.json
index 36385b1d72e..df135afff44 100644
--- a/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvAffectedHosts.fixture.json
+++ b/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvAffectedHosts.fixture.json
@@ -77,18 +77,6 @@
"build_status_label": "Installed",
"errata_status": 1,
"errata_status_label": "No installed packages and/or enabled repositories have been reported by subscription-manager.",
- "subscription_status": 0,
- "subscription_status_label": "Fully entitled",
- "purpose_sla_status": 3,
- "purpose_sla_status_label": "Not Specified",
- "purpose_role_status": 3,
- "purpose_role_status_label": "Not Specified",
- "purpose_usage_status": 3,
- "purpose_usage_status_label": "Not Specified",
- "purpose_addons_status": 3,
- "purpose_addons_status_label": "Not Specified",
- "purpose_status": 3,
- "purpose_status_label": "Not Specified",
"name": "affectedHost.example.com",
"id": 1,
"puppet_proxy_id": null,
@@ -132,7 +120,6 @@
"content_source": null,
"kickstart_repository": null
},
- "subscription_global_status": 0,
"subscription_facet_attributes": {
"id": 2,
"uuid": "de7dd78f-8eee-4308-90ce-c0e951da83f7",
|