diff --git a/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb b/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb
index e25dc95d7e3..e8d7699c0ca 100644
--- a/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb
+++ b/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb
@@ -447,7 +447,7 @@ def get_content_view_environments(label = nil, organization = nil)
end
def rhsm_params
- params.slice(:name, :type, :facts, :installedProducts, :autoheal, :releaseVer, :usage, :role, :addOns, :serviceLevel, :uuid, :capabilities, :guestIds, :lastCheckin).to_h
+ params.slice(:name, :type, :facts, :installedProducts, :autoheal, :releaseVer, :usage, :role, :serviceLevel, :uuid, :capabilities, :guestIds, :lastCheckin).to_h
end
def logger
diff --git a/app/controllers/katello/api/v2/activation_keys_controller.rb b/app/controllers/katello/api/v2/activation_keys_controller.rb
index 08c3121d9ac..3208bd1449c 100644
--- a/app/controllers/katello/api/v2/activation_keys_controller.rb
+++ b/app/controllers/katello/api/v2/activation_keys_controller.rb
@@ -13,7 +13,7 @@ class Api::V2::ActivationKeysController < Api::V2::ApiController # rubocop:disa
before_action :verify_simple_content_access_disabled, :only => [:add_subscriptions]
before_action :validate_release_version, :only => [:create, :update]
- wrap_parameters :include => (ActivationKey.attribute_names + %w(host_collection_ids service_level auto_attach purpose_role purpose_usage purpose_addons content_view_environments))
+ wrap_parameters :include => (ActivationKey.attribute_names + %w(host_collection_ids service_level auto_attach purpose_role purpose_usage content_view_environments))
def_param_group :activation_key do
param :organization_id, :number, :desc => N_("organization identifier"), :required => true
@@ -25,7 +25,6 @@ class Api::V2::ActivationKeysController < Api::V2::ApiController # rubocop:disa
param :auto_attach, :bool, :desc => N_("auto attach subscriptions upon registration"), deprecated: true
param :purpose_usage, String, :desc => N_("Sets the system purpose usage")
param :purpose_role, String, :desc => N_("Sets the system purpose usage")
- param :purpose_addons, Array, :desc => N_("Sets the system add-ons")
param :environment, Hash, :desc => N_("Hash containing the Id of the single lifecycle environment to be associated with the activation key."), deprecated: true
param :content_view_id, Integer, :desc => N_("Id of the single content view to be associated with the activation key."), :allow_nil => true
@@ -385,7 +384,6 @@ def permitted_params
:unlimited_hosts,
:purpose_role,
:purpose_usage,
- :purpose_addon_ids,
:content_overrides => [],
:host_collection_ids => [],
:content_view_environments => [],
@@ -396,9 +394,6 @@ def activation_key_params
key_params = permitted_params.except(:environment_id, :content_view_id,
:content_view_environments, :content_view_environment_ids)
- unless params[:purpose_addons].nil?
- key_params[:purpose_addon_ids] = params[:purpose_addons].map { |addon| ::Katello::PurposeAddon.find_or_create_by(name: addon).id }
- end
unlimited = params[:activation_key].try(:[], :unlimited_hosts)
max_hosts = params[:activation_key].try(:[], :max_hosts)
diff --git a/app/controllers/katello/api/v2/host_subscriptions_controller.rb b/app/controllers/katello/api/v2/host_subscriptions_controller.rb
index 9b8244bb39e..fa747bb9e19 100644
--- a/app/controllers/katello/api/v2/host_subscriptions_controller.rb
+++ b/app/controllers/katello/api/v2/host_subscriptions_controller.rb
@@ -20,7 +20,6 @@ class Api::V2::HostSubscriptionsController < Katello::Api::V2::ApiController
param :autoheal, :bool, :desc => N_("Sets whether the Host will autoheal subscriptions upon checkin")
param :purpose_usage, String, :desc => N_("Sets the system purpose usage")
param :purpose_role, String, :desc => N_("Sets the system purpose usage")
- param :purpose_addons, Array, :desc => N_("Sets the system add-ons")
param :service_level, String, :desc => N_("Service level to be used for autoheal")
param :hypervisor_guest_uuids, Array, :desc => N_("List of hypervisor guest uuids")
param :installed_products_attributes, Array, :desc => N_("List of products installed on the host") do
@@ -99,7 +98,6 @@ def params_to_rhsm_params
rhsm_params[:releaseVer] = params['release_version'] if params['release_version']
rhsm_params[:usage] = params['purpose_usage'] if params['purpose_usage']
rhsm_params[:role] = params['purpose_role'] if params['purpose_role']
- rhsm_params[:addOns] = params['purpose_addons'] if params['purpose_addons']
rhsm_params[:serviceLevel] = params['service_level'] if params['service_level']
rhsm_params[:guestIds] = params['hypervisor_guest_uuids'] if params[:hypervisor_guest_uuids]
rhsm_params[:type] = Katello::Candlepin::Consumer::SYSTEM
diff --git a/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb b/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb
index 5efacff9cf1..b7d391a852c 100644
--- a/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb
+++ b/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb
@@ -205,14 +205,12 @@ def resolve_traces
param :service_level, String, :desc => N_("Service level of host")
param :purpose_role, String, :desc => N_("Role of host")
param :purpose_usage, String, :desc => N_("Usage of host")
- param :purpose_addons, Array, :desc => N_("Sets the system add-ons")
def system_purpose
task = async_task(::Actions::BulkAction, ::Actions::Katello::Host::UpdateSystemPurpose,
@hosts,
params[:service_level],
params[:purpose_role],
- params[:purpose_usage],
- params[:purpose_addons])
+ params[:purpose_usage])
respond_for_async :resource => task
end
diff --git a/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb b/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
index a8fd16aa42d..0dde647da6d 100644
--- a/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
+++ b/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
@@ -18,7 +18,6 @@ def action_permission
included do
prepend Overrides
- before_action :purpose_addon_params, only: [:create, :update]
before_action :set_content_view_environments, only: [:create, :update]
def destroy
@@ -35,13 +34,6 @@ def host_collections
render(:locals => { :resource => @host }, :template => 'katello/api/v2/hosts/show', :status => :ok)
end
- def purpose_addon_params
- addons = params.dig(:host, :subscription_facet_attributes, :purpose_addons)
- return if addons.nil?
- params[:host][:subscription_facet_attributes][:purpose_addon_ids] = addons.map { |addon_name| ::Katello::PurposeAddon.find_or_create_by(name: addon_name).id }
- params[:host][:subscription_facet_attributes].delete(:purpose_addons)
- end
-
def set_content_view_environments
content_facet_attributes = params.dig(:host, :content_facet_attributes)
return if content_facet_attributes.blank? || @host&.content_facet.blank? ||
diff --git a/app/lib/actions/candlepin/activation_key/create.rb b/app/lib/actions/candlepin/activation_key/create.rb
index 1d2f00c3598..72be0d1b25a 100644
--- a/app/lib/actions/candlepin/activation_key/create.rb
+++ b/app/lib/actions/candlepin/activation_key/create.rb
@@ -8,7 +8,6 @@ class ActivationKey::Create < Candlepin::Abstract
param :release_version
param :purpose_role
param :purpose_usage
- param :purpse_addons
end
def run
@@ -18,8 +17,7 @@ def run
input[:service_level],
input[:release_version],
input[:purpose_role],
- input[:purpose_usage],
- input[:purpose_addons])
+ input[:purpose_usage])
end
end
end
diff --git a/app/lib/actions/candlepin/activation_key/update.rb b/app/lib/actions/candlepin/activation_key/update.rb
index 9bbccd05325..bda09754846 100644
--- a/app/lib/actions/candlepin/activation_key/update.rb
+++ b/app/lib/actions/candlepin/activation_key/update.rb
@@ -9,7 +9,6 @@ class Update < Candlepin::Abstract
param :auto_attach
param :purpose_role
param :purpose_usage
- param :purpose_addons
end
def run
@@ -19,8 +18,7 @@ def run
input[:service_level],
input[:auto_attach],
input[:purpose_role],
- input[:purpose_usage],
- input[:purpose_addons])
+ input[:purpose_usage])
end
end
end
diff --git a/app/lib/actions/katello/activation_key/create.rb b/app/lib/actions/katello/activation_key/create.rb
index 28cde9dd5bb..93396bbd03b 100644
--- a/app/lib/actions/katello/activation_key/create.rb
+++ b/app/lib/actions/katello/activation_key/create.rb
@@ -10,8 +10,7 @@ def plan(activation_key, params = {})
service_level: params[:service_level],
release_version: activation_key.release_version,
purpose_role: activation_key.purpose_role,
- purpose_usage: activation_key.purpose_usage,
- purpose_addons: activation_key.purpose_addons.pluck(:name))
+ purpose_usage: activation_key.purpose_usage)
cp_id = cp_create.output[:response][:id]
action_subject(activation_key, :cp_id => cp_id)
plan_self
diff --git a/app/lib/actions/katello/activation_key/update.rb b/app/lib/actions/katello/activation_key/update.rb
index f87fdb692b2..d207baa2e36 100644
--- a/app/lib/actions/katello/activation_key/update.rb
+++ b/app/lib/actions/katello/activation_key/update.rb
@@ -14,8 +14,7 @@ def plan(activation_key, activation_key_params)
service_level: activation_key.service_level,
auto_attach: activation_key.auto_attach,
purpose_role: activation_key.purpose_role,
- purpose_usage: activation_key.purpose_usage,
- purpose_addons: activation_key.purpose_addons.pluck(:name))
+ purpose_usage: activation_key.purpose_usage)
end
end
@@ -24,8 +23,7 @@ def update_candlepin?(activation_key, activation_key_params)
cp_changed?(activation_key.service_level, activation_key_params[:service_level]) ||
cp_changed?(activation_key.release_version, activation_key_params[:release_version]) ||
cp_changed?(activation_key.purpose_role, activation_key_params[:purpose_role]) ||
- cp_changed?(activation_key.purpose_usage, activation_key_params[:purpose_usage]) ||
- cp_changed?(activation_key.purpose_addon_ids, activation_key_params[:purpose_addon_ids])
+ cp_changed?(activation_key.purpose_usage, activation_key_params[:purpose_usage])
end
def cp_changed?(activation_key, activation_key_params)
diff --git a/app/lib/actions/katello/host/update_system_purpose.rb b/app/lib/actions/katello/host/update_system_purpose.rb
index a436239524e..6505c8f6915 100644
--- a/app/lib/actions/katello/host/update_system_purpose.rb
+++ b/app/lib/actions/katello/host/update_system_purpose.rb
@@ -2,18 +2,13 @@ module Actions
module Katello
module Host
class UpdateSystemPurpose < Actions::EntryAction
- def plan(host, service_level, purpose_role, purpose_usage, purpose_addons)
+ def plan(host, service_level, purpose_role, purpose_usage)
fail _("Host %s has not been registered with subscription-manager.") % host.name unless host.subscription_facet
host.subscription_facet.service_level = service_level unless service_level.nil?
host.subscription_facet.purpose_role = purpose_role unless purpose_role.nil?
host.subscription_facet.purpose_usage = purpose_usage unless purpose_usage.nil?
- if purpose_addons
- purpose_addon_objects = purpose_addons.delete_if(&:blank?).uniq.map { |x| ::Katello::PurposeAddon.find_or_create_by(name: x) }
- host.subscription_facet.purpose_addons = purpose_addon_objects
- end
-
host.save!
plan_self(:hostname => host.name)
end
diff --git a/app/lib/katello/resources/candlepin/activation_key.rb b/app/lib/katello/resources/candlepin/activation_key.rb
index 6796e84201e..753f1ac14b3 100644
--- a/app/lib/katello/resources/candlepin/activation_key.rb
+++ b/app/lib/katello/resources/candlepin/activation_key.rb
@@ -10,8 +10,7 @@ def get(id = nil, params = '', owner = nil)
::Katello::Util::Data.array_with_indifferent_access akeys
end
- # rubocop:disable Metrics/ParameterLists
- def create(name, owner_key, auto_attach, service_level, release_version, purpose_role, purpose_usage, purpose_addons)
+ def create(name, owner_key, auto_attach, service_level, release_version, purpose_role, purpose_usage)
url = "/candlepin/owners/#{owner_key}/activation_keys"
params = {
name: name,
@@ -20,14 +19,13 @@ def create(name, owner_key, auto_attach, service_level, release_version, purpose
releaseVer: release_version,
role: purpose_role,
usage: purpose_usage,
- addOns: purpose_addons,
}
response = self.post(url, params.to_json, self.default_headers)
JSON.parse(response.body).with_indifferent_access
end
- def update(id, release_version, service_level, auto_attach, purpose_role, purpose_usage, purpose_addons)
- attrs = { :releaseVer => release_version, :serviceLevel => service_level, :autoAttach => auto_attach, :role => purpose_role, :usage => purpose_usage, :addOns => purpose_addons }.delete_if { |_k, v| v.nil? }
+ def update(id, release_version, service_level, auto_attach, purpose_role, purpose_usage)
+ attrs = { :releaseVer => release_version, :serviceLevel => service_level, :autoAttach => auto_attach, :role => purpose_role, :usage => purpose_usage }.delete_if { |_k, v| v.nil? }
JSON.parse(self.put(path(id), attrs.to_json, self.default_headers).body).with_indifferent_access
end
diff --git a/app/models/katello/activation_key.rb b/app/models/katello/activation_key.rb
index 650340fdd03..ac462936746 100644
--- a/app/models/katello/activation_key.rb
+++ b/app/models/katello/activation_key.rb
@@ -27,11 +27,7 @@ class ActivationKey < Katello::Model
has_many :subscription_facet_activation_keys, :class_name => "Katello::SubscriptionFacetActivationKey", :dependent => :destroy
has_many :subscription_facets, :through => :subscription_facet_activation_keys
- has_many :activation_key_purpose_addons, :class_name => "Katello::ActivationKeyPurposeAddon", :dependent => :destroy, :inverse_of => :activation_key
- has_many :purpose_addons, :class_name => "Katello::PurposeAddon", :through => :activation_key_purpose_addons
-
before_destroy :validate_destroyable!
- accepts_nested_attributes_for :purpose_addons
validates_lengths_from_database
validates_with Validators::KatelloNameFormatValidator, :attributes => :name
@@ -88,7 +84,6 @@ class ActivationKey < Katello::Model
:only_explicit => true, :validator => ScopedSearch::Validators::INTEGER, :ext_method => :find_by_subscription_id
scoped_search :on => :purpose_usage, :rename => :usage, :complete_value => true
scoped_search :on => :purpose_role, :rename => :role, :complete_value => true
- scoped_search :on => :name, :rename => :addon, :relation => :purpose_addon, :complete_value => true, :ext_method => :find_by_purpose_addons
def self.in_environments(envs)
with_environments(envs)
@@ -270,12 +265,6 @@ def self.return_activation_keys_by_id(activation_key_ids)
end
end
- def self.find_by_purpose_addons(_key, operator, value)
- conditions = sanitize_sql_for_conditions(["#{Katello::PurposeAddon.table_name}.name #{operator} ?", value_to_sql(operator, value)])
- activation_keys = ::Katello::ActivationKey.joins(:purpose_addons).where(conditions)
- return_activation_keys_by_id(activation_keys.pluck(:id))
- end
-
def validate_destroyable!
if !organization.being_deleted? && Parameter.where(name: 'kt_activation_keys').pluck(:value).any? { |value| value.split(",").include?(name) }
fail _("This activation key is associated to one or more Hosts/Hostgroups. "\
diff --git a/app/models/katello/activation_key_purpose_addon.rb b/app/models/katello/activation_key_purpose_addon.rb
deleted file mode 100644
index c861aaec850..00000000000
--- a/app/models/katello/activation_key_purpose_addon.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-module Katello
- class ActivationKeyPurposeAddon < Katello::Model
- belongs_to :activation_key, inverse_of: :activation_key_purpose_addons, class_name: 'Katello::ActivationKey'
- belongs_to :purpose_addon, inverse_of: :activation_key_purpose_addons, class_name: 'Katello::PurposeAddon'
- end
-end
diff --git a/app/models/katello/concerns/subscription_facet_host_extensions.rb b/app/models/katello/concerns/subscription_facet_host_extensions.rb
index eab06c6fd7c..5d5cc84edee 100644
--- a/app/models/katello/concerns/subscription_facet_host_extensions.rb
+++ b/app/models/katello/concerns/subscription_facet_host_extensions.rb
@@ -14,7 +14,6 @@ module SubscriptionFacetHostExtensions
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 :rhel_lifecycle_status_object, :class_name => 'Katello::RhelLifecycleStatus', :foreign_key => 'host_id', :dependent => :destroy
has_one :hypervisor_host, :through => :subscription_facet
@@ -38,7 +37,6 @@ module SubscriptionFacetHostExtensions
scoped_search :on => :id, :relation => :pools, :rename => :subscription_id, :complete_value => true, :ext_method => :find_by_subscription_id, :only_explicit => true
scoped_search :on => :purpose_role, :rename => :role, :relation => :subscription_facet, :complete_value => true
scoped_search :on => :purpose_usage, :rename => :usage, :relation => :subscription_facet, :complete_value => true
- scoped_search :on => :name, :rename => :addon, :relation => :purpose_addons, :complete_value => true, :ext_method => :find_by_purpose_addon
before_update :update_candlepin_associations, if: -> { subscription_facet.try(:backend_update_needed?) }
end
@@ -81,12 +79,6 @@ def rhel_lifecycle_status_map
::Katello::RhelLifecycleStatus.status_map
end
- def find_by_purpose_addon(_key, operator, value)
- conditions = sanitize_sql_for_conditions(["#{Katello::PurposeAddon.table_name}.name #{operator} ?", value_to_sql(operator, value)])
- hosts = ::Host::Managed.joins(:purpose_addons).where(conditions)
- return_hosts(hosts)
- end
-
def find_by_activation_key(_key, operator, value)
conditions = sanitize_sql_for_conditions(["#{Katello::ActivationKey.table_name}.name #{operator} ?", value_to_sql(operator, value)])
hosts = ::Host::Managed.joins(:activation_keys).where(conditions)
diff --git a/app/models/katello/glue/candlepin/pool.rb b/app/models/katello/glue/candlepin/pool.rb
index dc0e0ce1630..6f01301802e 100644
--- a/app/models/katello/glue/candlepin/pool.rb
+++ b/app/models/katello/glue/candlepin/pool.rb
@@ -10,7 +10,7 @@ def self.included(base)
lazy_accessor :subscription_facts, :initializer => lambda { |_s| self.subscription ? self.subscription.attributes : {} }
lazy_accessor :pool_derived, :owner, :source_pool_id, :virt_limit, :arch, :description, :product_family,
- :variant, :suggested_quantity, :support_type, :product_id, :type, :upstream_entitlement_id, :roles, :usage, :addons,
+ :variant, :suggested_quantity, :support_type, :product_id, :type, :upstream_entitlement_id, :roles, :usage,
:initializer => :pool_facts
lazy_accessor :name, :support_level, :org, :sockets, :cores, :instance_multiplier,
diff --git a/app/models/katello/host/subscription_facet.rb b/app/models/katello/host/subscription_facet.rb
index 44c20f3d0de..43eb486229b 100644
--- a/app/models/katello/host/subscription_facet.rb
+++ b/app/models/katello/host/subscription_facet.rb
@@ -12,9 +12,6 @@ class SubscriptionFacet < Katello::Model
has_many :subscription_facet_activation_keys, :class_name => "Katello::SubscriptionFacetActivationKey", :dependent => :destroy, :inverse_of => :subscription_facet
has_many :activation_keys, :through => :subscription_facet_activation_keys, :class_name => "Katello::ActivationKey"
- has_many :subscription_facet_purpose_addons, :class_name => "Katello::SubscriptionFacetPurposeAddon", :dependent => :destroy, :inverse_of => :subscription_facet
- has_many :purpose_addons, :class_name => "Katello::PurposeAddon", :through => :subscription_facet_purpose_addons
-
has_many :subscription_facet_pools, :class_name => "Katello::SubscriptionFacetPool", :dependent => :delete_all, :inverse_of => :subscription_facet
has_many :pools, :through => :subscription_facet_pools, :class_name => "Katello::Pool"
@@ -27,9 +24,7 @@ class SubscriptionFacet < Katello::Model
DEFAULT_TYPE = 'system'.freeze
- accepts_nested_attributes_for :installed_products, :purpose_addons
-
- dirty_has_many_associations :purpose_addons
+ accepts_nested_attributes_for :installed_products
attr_accessor :facts
@@ -63,9 +58,6 @@ def import_database_attributes(consumer_params = candlepin_consumer.consumer_att
self.update_installed_products(consumer_params['installedProducts']) if consumer_params.key?('installedProducts')
self.purpose_role = consumer_params['role'] unless consumer_params['role'].nil?
self.purpose_usage = consumer_params['usage'] unless consumer_params['usage'].nil?
- unless consumer_params['addOns'].nil?
- self.purpose_addon_ids = consumer_params['addOns'].map { |addon_name| ::Katello::PurposeAddon.find_or_create_by(name: addon_name).id }
- end
unless consumer_params['releaseVer'].nil?
release = consumer_params['releaseVer']
@@ -141,7 +133,6 @@ def consumer_attributes
:autoheal => autoheal,
:usage => purpose_usage,
:role => purpose_role,
- :addOns => purpose_addons.pluck(:name),
:serviceLevel => service_level,
:releaseVer => release_version,
:environments => self.candlepin_environments,
@@ -283,7 +274,7 @@ def candlepin_consumer
end
def backend_update_needed?
- %w(release_version service_level autoheal purpose_role purpose_usage purpose_addon_ids).each do |method|
+ %w(release_version service_level autoheal purpose_role purpose_usage).each do |method|
if self.send("#{method}_changed?")
Rails.logger.debug("backend_update_needed: subscription facet #{method} changed")
return true
diff --git a/app/models/katello/purpose_addon.rb b/app/models/katello/purpose_addon.rb
deleted file mode 100644
index 36850317647..00000000000
--- a/app/models/katello/purpose_addon.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-module Katello
- class PurposeAddon < Katello::Model
- self.table_name = 'katello_purpose_addons'
-
- has_many :subscription_facet_purpose_addons, :class_name => "Katello::SubscriptionFacetPurposeAddon", :dependent => :destroy, :inverse_of => :purpose_addon
- has_many :subscription_facets, :through => :subscription_facet_purpose_addons, :class_name => "Katello::Host::SubscriptionFacet"
-
- has_many :activation_key_purpose_addons, :class_name => "Katello::ActivationKeyPurposeAddon", :dependent => :destroy, :inverse_of => :purpose_addon
- has_many :activation_keys, :through => :activation_key_purpose_addons, :class_name => "Katello::ActivationKey"
- end
-end
diff --git a/app/models/katello/subscription_facet_purpose_addon.rb b/app/models/katello/subscription_facet_purpose_addon.rb
deleted file mode 100644
index 8e660896eb0..00000000000
--- a/app/models/katello/subscription_facet_purpose_addon.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-module Katello
- class SubscriptionFacetPurposeAddon < Katello::Model
- belongs_to :subscription_facet, inverse_of: :subscription_facet_purpose_addons, class_name: 'Katello::Host::SubscriptionFacet'
- belongs_to :purpose_addon, inverse_of: :subscription_facet_purpose_addons, class_name: 'Katello::PurposeAddon'
- end
-end
diff --git a/app/views/katello/api/v2/activation_keys/base.json.rabl b/app/views/katello/api/v2/activation_keys/base.json.rabl
index e5b3681a118..8a4a298a7cc 100644
--- a/app/views/katello/api/v2/activation_keys/base.json.rabl
+++ b/app/views/katello/api/v2/activation_keys/base.json.rabl
@@ -51,10 +51,6 @@ end
attributes :usage_count, :user_id, :max_hosts, :system_template_id, :release_version, :purpose_usage, :purpose_role
-node :purpose_addons do |key|
- key.purpose_addons.pluck(:name)
-end
-
node :permissions do |activation_key|
{
:view_activation_keys => activation_key.readable?,
diff --git a/app/views/katello/api/v2/subscription_facet/base.json.rabl b/app/views/katello/api/v2/subscription_facet/base.json.rabl
index ae3014f663c..ef06bfac36a 100644
--- a/app/views/katello/api/v2/subscription_facet/base.json.rabl
+++ b/app/views/katello/api/v2/subscription_facet/base.json.rabl
@@ -3,7 +3,3 @@ attributes :id, :uuid, :last_checkin, :service_level, :release_version, :autohea
child :user => :user do
attributes :id, :login
end
-
-node :purpose_addons do |sub|
- sub.purpose_addons.pluck(:name)
-end
diff --git a/app/views/katello/api/v2/subscriptions/show.json.rabl b/app/views/katello/api/v2/subscriptions/show.json.rabl
index f3a63f44ed4..7d55af13bb1 100644
--- a/app/views/katello/api/v2/subscriptions/show.json.rabl
+++ b/app/views/katello/api/v2/subscriptions/show.json.rabl
@@ -5,7 +5,7 @@ extends "katello/api/v2/subscriptions/base"
attributes :arch
attributes :description
attributes :support_type
-attributes :roles, :usage, :addons
+attributes :roles, :usage
attributes :product_host_count
node(:host_count) do |subscription|
diff --git a/db/migrate/20190605014649_add_purpose_addons.rb b/db/migrate/20190605014649_add_purpose_addons.rb
index 7bf54b40d25..25db5f3b57f 100644
--- a/db/migrate/20190605014649_add_purpose_addons.rb
+++ b/db/migrate/20190605014649_add_purpose_addons.rb
@@ -12,18 +12,6 @@ def change
add_foreign_key :katello_subscription_facet_purpose_addons, :katello_subscription_facets, column: :subscription_facet_id, name: :katello_sub_facet_purpose_addon_facet_id
add_foreign_key :katello_subscription_facet_purpose_addons, :katello_purpose_addons, column: :purpose_addon_id, name: :katello_sub_facet_purpose_addon_purpose_addon_id
- Katello::Host::SubscriptionFacet.pluck(:id, :purpose_addons).each do |facet|
- yaml_string = facet[1]
- next if yaml_string.nil?
-
- parsed = YAML.parse(yaml_string)
- addon_names = parsed.root.children.map(&:value)
- addon_names.each do |addon|
- purpose_addon = Katello::PurposeAddon.find_or_create_by(name: addon)
- Katello::SubscriptionFacetPurposeAddon.create(purpose_addon_id: purpose_addon.id, subscription_facet_id: facet[0])
- end
- end
-
remove_column :katello_subscription_facets, :purpose_addons, :text
end
end
diff --git a/db/migrate/20200818192230_update_system_purpose_status.rb b/db/migrate/20200818192230_update_system_purpose_status.rb
index 66e6b78361a..a727265a2f9 100644
--- a/db/migrate/20200818192230_update_system_purpose_status.rb
+++ b/db/migrate/20200818192230_update_system_purpose_status.rb
@@ -2,7 +2,6 @@ class UpdateSystemPurposeStatus < ActiveRecord::Migration[6.0]
def change
purpose_types = [
"Katello::PurposeStatus",
- "Katello::PurposeAddonsStatus",
"Katello::PurposeRoleStatus",
"Katello::PurposeSlaStatus",
"Katello::PurposeUsageStatus",
diff --git a/db/migrate/20240207191223_remove_entitlement_mode_host_statuses.rb b/db/migrate/20240207191223_remove_entitlement_mode_host_statuses.rb
index 03aa66d81d9..47f186fddb3 100644
--- a/db/migrate/20240207191223_remove_entitlement_mode_host_statuses.rb
+++ b/db/migrate/20240207191223_remove_entitlement_mode_host_statuses.rb
@@ -8,7 +8,6 @@ def up
obsolete_statuses = [
"Katello::SubscriptionStatus",
"Katello::PurposeStatus",
- "Katello::PurposeAddonsStatus",
"Katello::PurposeRoleStatus",
"Katello::PurposeSlaStatus",
"Katello::PurposeUsageStatus",
diff --git a/db/migrate/20241101144625_remove_system_purpose_addons.rb b/db/migrate/20241101144625_remove_system_purpose_addons.rb
new file mode 100644
index 00000000000..86e867aabd1
--- /dev/null
+++ b/db/migrate/20241101144625_remove_system_purpose_addons.rb
@@ -0,0 +1,9 @@
+class RemoveSystemPurposeAddons < ActiveRecord::Migration[6.1]
+ def change
+ remove_foreign_key :katello_subscription_facet_purpose_addons, :katello_purpose_addons, column: :purpose_addon_id
+
+ drop_table :katello_activation_key_purpose_addons
+ drop_table :katello_purpose_addons
+ drop_table :katello_subscription_facet_purpose_addons
+ end
+end
diff --git a/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details-info.controller.js b/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details-info.controller.js
index 436708a5ef9..3590156ea5d 100644
--- a/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details-info.controller.js
+++ b/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details-info.controller.js
@@ -117,11 +117,6 @@ angular.module('Bastion.activation-keys').controller('ActivationKeyDetailsInfoCo
$scope.save($scope.activationKey);
};
- $scope.clearAddOns = function () {
- $scope.activationKey['purpose_addons'] = [];
- $scope.save($scope.activationKey);
- };
-
$scope.contentViews = function () {
var deferred = $q.defer();
diff --git a/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details.controller.js b/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details.controller.js
index bf92b50c586..9b435a72c1c 100644
--- a/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details.controller.js
+++ b/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details.controller.js
@@ -22,11 +22,9 @@ angular.module('Bastion.activation-keys').controller('ActivationKeyDetailsContro
$scope.defaultRoles = ['Red Hat Enterprise Linux Server', 'Red Hat Enterprise Linux Workstation', 'Red Hat Enterprise Linux Compute Node'];
$scope.defaultUsages = ['Production', 'Development/Test', 'Disaster Recovery'];
- $scope.purposeAddonsCount = 0;
$scope.simpleContentAccessEnabled = simpleContentAccessEnabled;
- $scope.organization = Organization.get({id: CurrentOrganization}, function(org) {
- $scope.purposeAddonsCount += org.system_purposes.addons.length;
+ $scope.organization = Organization.get({id: CurrentOrganization}, function() {
});
$scope.panel = {
@@ -113,43 +111,5 @@ angular.module('Bastion.activation-keys').controller('ActivationKeyDetailsContro
return _.union(roles, $scope.defaultRoles);
});
};
-
-
- $scope.savePurposeAddons = function (key) {
-
- if ($scope.purposeAddonsList) {
- key['purpose_addons'] = _.chain($scope.purposeAddonsList).filter(function(addOn) {
- return addOn.selected;
- }).map(function(addOn) {
- return addOn.name;
- }).value();
- }
-
- return $scope.save(key);
- };
-
-
- $scope.purposeAddons = function () {
- var purposeAddons;
- var addOns;
-
- return $scope.organization.$promise.then(function(org) {
- $scope.purposeAddonsList = [];
- addOns = org.system_purposes.addons;
-
- purposeAddons = $scope.activationKey.purpose_addons;
- angular.forEach(purposeAddons, function(addOn) {
- if (addOn && !_.includes(addOns, addOn)) {
- addOns.push(addOn);
- }
- });
-
- angular.forEach(addOns, function (addOn) {
- $scope.purposeAddonsList.push({"name": addOn, "selected": purposeAddons.indexOf(addOn) > -1});
- });
-
- return $scope.purposeAddonsList;
- });
- };
}]
);
diff --git a/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-info.html b/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-info.html
index d90fae09b12..dac4e95c809 100644
--- a/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-info.html
+++ b/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-info.html
@@ -93,18 +93,6 @@
System Purpose
on-delete="clearRole()"
on-save="save(activationKey)">
-
- Add ons
-
-
-
diff --git a/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-system-purpose-modal.controller.js b/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-system-purpose-modal.controller.js
index 6f6d8020b14..163b482329f 100644
--- a/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-system-purpose-modal.controller.js
+++ b/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-system-purpose-modal.controller.js
@@ -19,14 +19,6 @@ angular.module('Bastion.content-hosts').controller('ContentHostsBulkSystemPurpos
$scope.organization = Organization.get({id: CurrentOrganization});
- $scope.purposeAddonsList = function () {
- var defaultOptions = ['No Change', 'None (Clear)'];
- if ($scope.organization.system_purposes && $scope.organization.system_purposes.addons) {
- return defaultOptions.concat($scope.organization.system_purposes.addons);
- }
- return [];
- };
-
$scope.defaultUsages = ['No change', 'None (Clear)', 'Production', 'Development/Test', 'Disaster Recovery'];
$scope.defaultRoles = ['No change', 'None (Clear)', 'Red Hat Enterprise Linux Server', 'Red Hat Enterprise Linux Workstation', 'Red Hat Enterprise Linux Compute Node'];
$scope.defaultServiceLevels = ['No change', 'None (Clear)', 'Self-Support', 'Standard', 'Premium'];
@@ -37,54 +29,22 @@ angular.module('Bastion.content-hosts').controller('ContentHostsBulkSystemPurpos
$scope.selectedRoles = $scope.defaultRoles[0];
$scope.selectedServiceLevels = $scope.defaultServiceLevels[0];
- $scope.selected = {
- addons: undefined
- };
-
$scope.selectedItemToParam = function (item) {
var mapping = {
"None (Clear)": "",
- "No change": null,
- "": []
+ "No change": null
};
- if (Array.isArray(item)) {
- return $scope.selectedAddonsToParam(item);
- }
if (mapping.hasOwnProperty(item)) {
return mapping[item];
}
return item;
};
- $scope.selectedAddonsToParam = function (addons) {
- var intentOptions = ['No Change', 'None (Clear)'];
-
- var userIntent = intentOptions.filter(function(val) {
- return addons.indexOf(val) !== -1;
- });
-
- if (userIntent.length === 0) {
- return addons;
- }
-
- if (userIntent.includes('No Change')) {
- return null;
- }
-
- if (userIntent.includes('None (Clear)') && addons.length === 1) {
- return [];
- } if (userIntent.includes('None (Clear)') && addons.length > 1) {
- addons.shift();
- return addons;
- }
- };
-
function actionParams() {
var params = hostIds;
params['purpose_usage'] = $scope.selectedItemToParam($scope.selectedUsages);
params['purpose_role'] = $scope.selectedItemToParam($scope.selectedRoles);
- params['purpose_addons'] = $scope.selectedItemToParam($scope.selectedAddons);
params['service_level'] = $scope.selectedItemToParam($scope.selectedServiceLevels);
return params;
diff --git a/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-system-purpose-modal.html b/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-system-purpose-modal.html
index b0207e750f2..42e548a33a5 100644
--- a/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-system-purpose-modal.html
+++ b/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-system-purpose-modal.html
@@ -47,19 +47,6 @@ Assign System Purpose
id="selectedRoles"
>
-
-
-
-
-
-
-
ctrl-click or shift-click to select multiple Add ons
-
-
diff --git a/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details-info.controller.js b/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details-info.controller.js
index a855474216b..c562b98c6fb 100644
--- a/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details-info.controller.js
+++ b/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details-info.controller.js
@@ -109,11 +109,6 @@ angular.module('Bastion.content-hosts').controller('ContentHostDetailsInfoContro
$scope.saveSubscriptionFacet($scope.host);
};
- $scope.clearAddOns = function () {
- $scope.host.subscription_facet_attributes['purpose_addons'] = [];
- $scope.saveSubscriptionFacet($scope.host);
- };
-
$scope.clearServiceLevel = function () {
$scope.host.subscription_facet_attributes['service_level'] = '';
$scope.saveSubscriptionFacet($scope.host);
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 8c25a20c836..8d4afbae4c9 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
@@ -25,15 +25,13 @@ angular.module('Bastion.content-hosts').controller('ContentHostDetailsController
$scope.getHostStatusIcon = ContentHostsHelper.getHostStatusIcon;
- $scope.organization = Organization.get({id: CurrentOrganization}, function(org) {
- $scope.purposeAddonsCount += org.system_purposes.addons.length;
+ $scope.organization = Organization.get({id: CurrentOrganization}, function() {
});
$scope.defaultUsages = ['Production', 'Development/Test', 'Disaster Recovery'];
$scope.defaultRoles = ['Red Hat Enterprise Linux Server', 'Red Hat Enterprise Linux Workstation', 'Red Hat Enterprise Linux Compute Node'];
$scope.defaultServiceLevels = ['Self-Support', 'Standard', 'Premium'];
- $scope.purposeAddonsCount = 0;
$scope.simpleContentAccessEnabled = simpleContentAccessEnabled;
$scope.panel = {
@@ -46,7 +44,6 @@ angular.module('Bastion.content-hosts').controller('ContentHostDetailsController
host.unregisterDelete = !host.hasSubscription() || deleteHostOnUnregister;
host.deleteHostOnUnregister = deleteHostOnUnregister;
$scope.panel.loading = false;
- $scope.purposeAddonsCount += host.subscription_facet_attributes.purpose_addons.length;
}, function (response) {
$scope.panel.loading = false;
ApiErrorHandler.handleGETRequestErrors(response, $scope);
@@ -83,14 +80,6 @@ angular.module('Bastion.content-hosts').controller('ContentHostDetailsController
'release_version': host.subscription_facet_attributes.release_version
};
- if ($scope.purposeAddonsList) {
- newHost['subscription_facet_attributes']['purpose_addons'] = _.chain($scope.purposeAddonsList).filter(function(addOn) {
- return addOn.selected;
- }).map(function(addOn) {
- return addOn.name;
- }).value();
- }
-
return $scope.save(newHost, true);
};
// @TODO end hack
@@ -192,29 +181,6 @@ angular.module('Bastion.content-hosts').controller('ContentHostDetailsController
});
};
- $scope.purposeAddons = function () {
- var purposeAddons;
- var addOns;
-
- return $scope.organization.$promise.then(function(org) {
- $scope.purposeAddonsList = [];
- addOns = org.system_purposes.addons;
-
- purposeAddons = $scope.host.subscription_facet_attributes.purpose_addons;
- angular.forEach(purposeAddons, function(addOn) {
- if (addOn && !_.includes(addOns, addOn)) {
- addOns.push(addOn);
- }
- });
-
- angular.forEach(addOns, function (addOn) {
- $scope.purposeAddonsList.push({"name": addOn, "selected": purposeAddons.indexOf(addOn) > -1});
- });
-
- return $scope.purposeAddonsList;
- });
- };
-
$scope.unregisterContentHost = function (host) {
var errorHandler = function (response) {
host.deleting = false;
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 d9d432fade3..5b85b88f4e4 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
@@ -130,18 +130,6 @@ Subscriptions
on-delete="clearRole()"
on-save="saveSubscriptionFacet(host)">
-
- Add ons
-
-
-
diff --git a/engines/bastion_katello/test/activation-keys/details/activation-key-details-info.controller.test.js b/engines/bastion_katello/test/activation-keys/details/activation-key-details-info.controller.test.js
index f3cd064c1a4..f05dc0c3f99 100644
--- a/engines/bastion_katello/test/activation-keys/details/activation-key-details-info.controller.test.js
+++ b/engines/bastion_katello/test/activation-keys/details/activation-key-details-info.controller.test.js
@@ -47,7 +47,6 @@ describe('Controller: ActivationKeyDetailsInfoController', function() {
id: 2,
purpose_usage: "test usage",
purpose_role: "test role",
- purpose_addons: ["test addon1"],
hasContent: function() { return true; }
});
@@ -89,10 +88,4 @@ describe('Controller: ActivationKeyDetailsInfoController', function() {
$scope.clearRole();
expect($scope.activationKey['purpose_role']).toBe('');
});
-
- it('should clear addOns', function() {
- $scope.clearAddOns();
- expect($scope.activationKey['purpose_addons']).toEqual([]);
- });
-
});
\ No newline at end of file
diff --git a/engines/bastion_katello/test/activation-keys/details/activation-key-details.controller.test.js b/engines/bastion_katello/test/activation-keys/details/activation-key-details.controller.test.js
index d5128515b34..96adeab4e7f 100644
--- a/engines/bastion_katello/test/activation-keys/details/activation-key-details.controller.test.js
+++ b/engines/bastion_katello/test/activation-keys/details/activation-key-details.controller.test.js
@@ -23,8 +23,7 @@ describe('Controller: ActivationKeyDetailsController', function() {
id: '1',
system_purposes: {
roles: ['custom-role'],
- usage: ['custom-usage'],
- addons: ['custom-addon']
+ usage: ['custom-usage']
}
}
@@ -43,7 +42,6 @@ describe('Controller: ActivationKeyDetailsController', function() {
environment: mockEnvironment,
purpose_usage: 'current-usage',
purpose_role: 'current-role',
- purpose_addons: ['current-addon'],
$update: function (success, error) {
if (mockActivationKey.failed) {
error({data: {error: {full_messages: ['error!']}}});
@@ -111,16 +109,6 @@ describe('Controller: ActivationKeyDetailsController', function() {
});
$httpBackend.flush();
});
-
- it("provides a list of system purpose addons", function() {
- $scope.purposeAddons().then(function(addons) {
- expect(addons).toEqual([
- {name: 'custom-addon', selected: false},
- {name: 'current-addon', selected: true},
- ]);
- });
- $httpBackend.flush();
- });
});
diff --git a/engines/bastion_katello/test/content-hosts/bulk/content-hosts-bulk-system-purpose-modal.controller.test.js b/engines/bastion_katello/test/content-hosts/bulk/content-hosts-bulk-system-purpose-modal.controller.test.js
index 0903dec1139..64c1c7353d0 100644
--- a/engines/bastion_katello/test/content-hosts/bulk/content-hosts-bulk-system-purpose-modal.controller.test.js
+++ b/engines/bastion_katello/test/content-hosts/bulk/content-hosts-bulk-system-purpose-modal.controller.test.js
@@ -18,8 +18,7 @@ describe('Controller: ContentHostsBulkSystemPurposeModalController', function()
service_levels: ['Premium'],
system_purposes: {
roles: ['custom-role'],
- usage: ['custom-usage'],
- addons: ['custom-addon']
+ usage: ['custom-usage']
}
}
@@ -53,7 +52,6 @@ describe('Controller: ContentHostsBulkSystemPurposeModalController', function()
var usageRoles = $scope.defaultRoles;
var usages = $scope.defaultUsages;
$httpBackend.flush();
- var addons = $scope.purposeAddonsList();
expect(serviceLevels.length).toEqual(5);
expect(serviceLevels.sort()).toEqual(['No change', 'None (Clear)', 'Self-Support', 'Standard', 'Premium'].sort());
@@ -61,12 +59,10 @@ describe('Controller: ContentHostsBulkSystemPurposeModalController', function()
expect(usageRoles.sort()).toEqual(['No change', 'None (Clear)', 'Red Hat Enterprise Linux Server', 'Red Hat Enterprise Linux Workstation', 'Red Hat Enterprise Linux Compute Node'].sort());
expect(usages.length).toEqual(5);
expect(usages.sort()).toEqual(['No change', 'None (Clear)', 'Production', 'Development/Test', 'Disaster Recovery'].sort());
- expect(addons.length).toEqual(3);
- expect(addons.sort()).toEqual(['No Change', 'None (Clear)', 'custom-addon'].sort());
});
it("should perform the function and transition", function() {
- var params = _.extend(hostIds, {purpose_usage: null, purpose_role: null, service_level: null, purpose_addons: null});
+ var params = _.extend(hostIds, {purpose_usage: null, purpose_role: null, service_level: null});
spyOn(BulkAction, 'systemPurpose');
$scope.performAction();
@@ -75,20 +71,13 @@ describe('Controller: ContentHostsBulkSystemPurposeModalController', function()
});
it("should return null when 'No Change' is selected", function() {
- var param = $scope.selectedItemToParam(['No Change']);
+ var param = $scope.selectedItemToParam(['No change']);
expect(param).toEqual(null);
});
it("should return empty string/array when 'None (Clear)' is only selected", function() {
var stringParam = $scope.selectedItemToParam('None (Clear)');
- var addonParam = $scope.selectedItemToParam(['None (Clear)']);
expect(stringParam).toEqual("");
- expect(addonParam).toEqual([]);
- });
-
- it("should return addons when 'None (Clear)' is selected with other addons", function() {
- var addonParam = $scope.selectedItemToParam(['None (Clear)', 'custom-addon']);
- expect(addonParam).toEqual(['custom-addon'])
});
it("provides a function for closing the modal", function () {
diff --git a/engines/bastion_katello/test/content-hosts/details/content-host-details.controller.test.js b/engines/bastion_katello/test/content-hosts/details/content-host-details.controller.test.js
index 8deb33147be..4501f5589d4 100644
--- a/engines/bastion_katello/test/content-hosts/details/content-host-details.controller.test.js
+++ b/engines/bastion_katello/test/content-hosts/details/content-host-details.controller.test.js
@@ -28,8 +28,7 @@ describe('Controller: ContentHostDetailsController', function() {
service_levels: ['Premium'],
system_purposes: {
roles: ['custom-role'],
- usage: ['custom-usage'],
- addons: ['custom-addon']
+ usage: ['custom-usage']
}
}
@@ -65,8 +64,7 @@ describe('Controller: ContentHostDetailsController', function() {
autoheal: true,
service_level: 'Premium',
purpose_role: 'current-role',
- purpose_usage: 'current-usage',
- purpose_addons: ['current-addon']
+ purpose_usage: 'current-usage'
},
$update: function(success, error) {
@@ -135,27 +133,6 @@ describe('Controller: ContentHostDetailsController', function() {
}
};
});
-
- it("sends purpose addons when they are set", function() {
- spyOn($scope, 'save');
- $scope.purposeAddonsList = [
- {name: "Addon1", selected: true},
- {name: "Addon2", selected: false},
- ];
- expectedHost['subscription_facet_attributes']['purpose_addons'] = ['Addon1'];
-
- $scope.saveSubscriptionFacet(mockHost);
-
- expect($scope.save).toHaveBeenCalledWith(expectedHost, true);
- });
-
- it ("doesn't send addons when they aren't set", function() {
- spyOn($scope, 'save');
-
- $scope.saveSubscriptionFacet(mockHost);
-
- expect($scope.save).toHaveBeenCalledWith(expectedHost, true);
- });
});
it("sets the menu expander on the scope", function() {
@@ -190,16 +167,6 @@ describe('Controller: ContentHostDetailsController', function() {
$httpBackend.flush();
});
- it("provides a list of system purpose addons", function() {
- $scope.purposeAddons().then(function(addons) {
- expect(addons).toEqual([
- {name: 'custom-addon', selected: false},
- {name: 'current-addon', selected: true},
- ]);
- });
- $httpBackend.flush();
- });
-
it("gets the host using the Host service and puts it on the $scope.", function() {
expect(Host.get).toHaveBeenCalledWith({id: mockHost.id}, jasmine.any(Function), jasmine.any(Function));
expect($scope.host).toBe(mockHost);
diff --git a/lib/katello/plugin.rb b/lib/katello/plugin.rb
index 515ef6c17aa..4c5ee25098e 100644
--- a/lib/katello/plugin.rb
+++ b/lib/katello/plugin.rb
@@ -226,7 +226,7 @@
:content_facet_attributes => [:content_view_id, :lifecycle_environment_id, :content_source_id,
:host, :kickstart_repository_id],
:subscription_facet_attributes => [:release_version, :autoheal, :purpose_usage, :purpose_role, :service_level, :host,
- {:installed_products => [:product_id, :product_name, :arch, :version]}, :facts, {:hypervisor_guest_uuids => []}, {:purpose_addon_ids => []}]
+ {:installed_products => [:product_id, :product_name, :arch, :version]}, :facts, {:hypervisor_guest_uuids => []}]
parameter_filter ::Hostgroup, :content_view_id, :lifecycle_environment_id, :content_source_id,
:kickstart_repository_id
parameter_filter Organization, :label, :service_level
diff --git a/test/actions/candlepin/activation_key_test.rb b/test/actions/candlepin/activation_key_test.rb
index 0136c5ff872..6826fcb5879 100644
--- a/test/actions/candlepin/activation_key_test.rb
+++ b/test/actions/candlepin/activation_key_test.rb
@@ -17,14 +17,13 @@ class Actions::Candlepin::ActivationKey::CreateTest < ActiveSupport::TestCase
service_level: 'Self-Support',
release_version: '7Server',
purpose_role: "role",
- purpose_usage: "usage",
- purpose_addons: ["Test"]
+ purpose_usage: "usage"
)
end
it 'runs' do
::Katello::Util::Model.stubs(:uuid).returns(123)
- ::Katello::Resources::Candlepin::ActivationKey.expects(:create).with(123, nil, true, "Self-Support", "7Server", "role", "usage", ["Test"])
+ ::Katello::Resources::Candlepin::ActivationKey.expects(:create).with(123, nil, true, "Self-Support", "7Server", "role", "usage")
run_action planned_action
end
end
@@ -42,11 +41,11 @@ class Actions::Candlepin::ActivationKey::UpdateTest < ActiveSupport::TestCase
let(:action_class) { ::Actions::Candlepin::ActivationKey::Update }
let(:planned_action) do
- create_and_plan_action(action_class, cp_id: "foo", :release_version => 1, :service_level => "Premium", :auto_attach => true, :purpose_role => "test role", :purpose_usage => "test usage", :purpose_addons => ["test1"])
+ create_and_plan_action(action_class, cp_id: "foo", :release_version => 1, :service_level => "Premium", :auto_attach => true, :purpose_role => "test role", :purpose_usage => "test usage")
end
it 'runs' do
- ::Katello::Resources::Candlepin::ActivationKey.expects(:update).with("foo", 1, "Premium", true, "test role", "test usage", ["test1"])
+ ::Katello::Resources::Candlepin::ActivationKey.expects(:update).with("foo", 1, "Premium", true, "test role", "test usage")
run_action planned_action
end
end
diff --git a/test/actions/katello/activation_key_test.rb b/test/actions/katello/activation_key_test.rb
index 2c78ed65185..63e66004d12 100644
--- a/test/actions/katello/activation_key_test.rb
+++ b/test/actions/katello/activation_key_test.rb
@@ -20,7 +20,6 @@ class CreateTest < TestBase
:release_version => activation_key.release_version,
:purpose_usage => activation_key.purpose_usage,
:purpose_role => activation_key.purpose_role,
- :purpose_addons => [katello_purpose_addons(:addon).name],
}
end
it 'plans' do
@@ -40,7 +39,7 @@ class CreateTest < TestBase
class UpdateTest < TestBase
let(:action_class) { ::Actions::Katello::ActivationKey::Update }
- let(:input) { { :auto_attach => 'false', :purpose_usage => "usage", :purpose_role => "role", :purpose_addon_ids => [katello_purpose_addons(:addon).id]} }
+ let(:input) { { :auto_attach => 'false', :purpose_usage => "usage", :purpose_role => "role"} }
it 'plans' do
action.expects(:action_subject).with(activation_key)
@@ -50,7 +49,6 @@ class UpdateTest < TestBase
assert_action_planed(action, ::Actions::Candlepin::ActivationKey::Update)
assert_equal(activation_key.purpose_usage, "usage")
assert_equal(activation_key.purpose_role, "role")
- assert_equal(activation_key.purpose_addon_ids, [katello_purpose_addons(:addon).id])
assert_equal(activation_key.auto_attach, false)
end
end
diff --git a/test/actions/katello/host/update_system_purpose_test.rb b/test/actions/katello/host/update_system_purpose_test.rb
index cb90240cc69..2ad1b74fae2 100644
--- a/test/actions/katello/host/update_system_purpose_test.rb
+++ b/test/actions/katello/host/update_system_purpose_test.rb
@@ -14,51 +14,45 @@ def setup
@service_level = 'Standard'
@purpose_role = 'Red Hat Enterprise Linux Server'
@purpose_usage = 'Production'
- @purpose_addons = ['Addon One', 'Addon Two', 'Addon Two', '']
@action = create_action action_class
end
def test_update_system_purpose
@host.expects(:update_candlepin_associations)
- plan_action @action, @host, @service_level, @purpose_role, @purpose_usage, @purpose_addons
+ plan_action @action, @host, @service_level, @purpose_role, @purpose_usage
assert_equal(@host.subscription_facet.service_level, @service_level)
assert_equal(@host.subscription_facet.purpose_role, @purpose_role)
assert_equal(@host.subscription_facet.purpose_usage, @purpose_usage)
- assert_equal(['Addon One', 'Addon Two'], @host.subscription_facet.purpose_addons.pluck(:name))
end
def test_dont_clear_host_values_on_nil_params
@host.expects(:update_candlepin_associations)
- @host.subscription_facet.purpose_addons << katello_purpose_addons(:addon)
@host.subscription_facet.service_level = @service_level
@host.subscription_facet.purpose_role = @purpose_role
@host.subscription_facet.purpose_usage = @purpose_usage
- plan_action @action, @host, nil, nil, nil, nil
+ plan_action @action, @host, nil, nil, nil
assert_equal(@host.subscription_facet.service_level, @service_level)
assert_equal(@host.subscription_facet.purpose_role, @purpose_role)
assert_equal(@host.subscription_facet.purpose_usage, @purpose_usage)
- assert_equal(@host.subscription_facet.purpose_addons.first.name, katello_purpose_addons(:addon).name)
end
def test_unset_value_with_empty_string_array
@host.expects(:update_candlepin_associations)
- @host.subscription_facet.purpose_addons << katello_purpose_addons(:addon)
@host.subscription_facet.service_level = @service_level
@host.subscription_facet.purpose_role = @purpose_role
@host.subscription_facet.purpose_usage = @purpose_usage
- plan_action @action, @host, '', '', '', []
+ plan_action @action, @host, '', '', ''
assert_equal(@host.subscription_facet.service_level, "")
assert_equal(@host.subscription_facet.purpose_role, "")
assert_equal(@host.subscription_facet.purpose_usage, "")
- assert_equal(@host.subscription_facet.purpose_addons, [])
end
end
end
diff --git a/test/controllers/api/v2/host_subscriptions_controller_test.rb b/test/controllers/api/v2/host_subscriptions_controller_test.rb
index 0b8a3e5d235..eaad900c11e 100644
--- a/test/controllers/api/v2/host_subscriptions_controller_test.rb
+++ b/test/controllers/api/v2/host_subscriptions_controller_test.rb
@@ -148,7 +148,6 @@ def test_create
'type' => 'system',
'role' => 'MyRole',
'usage' => 'MyUsage',
- 'addOns' => 'Addon1,Addon2',
'facts' => facts,
'installedProducts' => [{
'productId' => '1',
@@ -167,7 +166,6 @@ def test_create
:installed_products => installed_products,
:purpose_role => 'MyRole',
:purpose_usage => 'MyUsage',
- :purpose_addons => 'Addon1,Addon2',
}
)
diff --git a/test/controllers/api/v2/hosts_bulk_actions_controller_test.rb b/test/controllers/api/v2/hosts_bulk_actions_controller_test.rb
index 68e402a717e..ce905780229 100644
--- a/test/controllers/api/v2/hosts_bulk_actions_controller_test.rb
+++ b/test/controllers/api/v2/hosts_bulk_actions_controller_test.rb
@@ -93,20 +93,18 @@ def test_system_purpose
host_service_level = 'Standard'
host_purpose_role = 'Red Hat Enterprise Linux Server'
host_purpose_usage = 'Production'
- host_purpose_addons = ['foo']
- assert_async_task(::Actions::BulkAction) do |action_class, hosts, service_level_param, purpose_role_param, purpose_usage_param, purpose_addons_param|
+ assert_async_task(::Actions::BulkAction) do |action_class, hosts, service_level_param, purpose_role_param, purpose_usage_param|
assert_equal action_class, ::Actions::Katello::Host::UpdateSystemPurpose
assert_includes hosts, @host1
assert_includes hosts, @host2
assert_equal host_service_level, service_level_param
assert_equal host_purpose_role, purpose_role_param
assert_equal host_purpose_usage, purpose_usage_param
- assert_equal host_purpose_addons, purpose_addons_param
end
put :system_purpose, params: { :included => {:ids => @host_ids}, :service_level => host_service_level, :purpose_role => host_purpose_role,
- :purpose_usage => host_purpose_usage, :purpose_addons => host_purpose_addons}
+ :purpose_usage => host_purpose_usage}
assert_response :success
end
@@ -119,11 +117,10 @@ def test_system_purpose_permission
host_service_level = 'Standard'
host_purpose_usage = 'Production'
host_purpose_role = 'Red Hat Enterprise Linux Server'
- host_purpose_addons = ['foo']
assert_protected_action(:release_version, good_perms, bad_perms) do
put :system_purpose, params: { :included => {:ids => @host_ids}, :service_level => host_service_level, :purpose_role => host_purpose_role,
- :purpose_usage => host_purpose_usage, :purpose_addons => host_purpose_addons}
+ :purpose_usage => host_purpose_usage}
end
end
diff --git a/test/controllers/api/v2/hosts_controller_test.rb b/test/controllers/api/v2/hosts_controller_test.rb
index 8a0ba302e06..56b95742297 100644
--- a/test/controllers/api/v2/hosts_controller_test.rb
+++ b/test/controllers/api/v2/hosts_controller_test.rb
@@ -247,7 +247,7 @@ def test_with_smartproxy
def test_create_with_permitted_attributes
cf_attrs = {:content_view_id => @content_view.id, :lifecycle_environment_id => @environment.id}
- sf_attrs = {:purpose_addons => ["Addon"]}
+ sf_attrs = {:purpose_role => "MyRole"}
attrs = @host.clone.attributes.merge("name" => "contenthost.example.com", "content_facet_attributes" => cf_attrs, "subscription_facet_attributes" => sf_attrs).compact!
assert_difference('Host.unscoped.count') do
@@ -267,18 +267,4 @@ def test_create_with_unpermitted_attributes
assert_response :success # the uuid is simply filtered out which allows the host to be still saved
refute Katello::Host::ContentFacet.where(:uuid => cf_attrs[:uuid]).exists?
end
-
- def test_create_purpose_addons
- sf_attrs = {:purpose_addons => ["Addon", katello_purpose_addons(:addon).name]}
- attrs = @host.clone.attributes.merge("name" => "host", "subscription_facet_attributes" => sf_attrs)
-
- post :create, params: attrs
-
- host_id = JSON.parse(response.body)["id"]
- host = Host.find(host_id)
- addon_names = host.subscription_facet.purpose_addons.pluck(:name)
-
- assert_equal addon_names.sort, sf_attrs[:purpose_addons].sort
- assert_response :success
- end
end
diff --git a/test/fixtures/models/katello_activation_key_purpose_addons.yml b/test/fixtures/models/katello_activation_key_purpose_addons.yml
deleted file mode 100644
index 63419ce832e..00000000000
--- a/test/fixtures/models/katello_activation_key_purpose_addons.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-relation:
- purpose_addon_id: <%= ActiveRecord::FixtureSet.identify(:addon) %>
- activation_key_id: <%= ActiveRecord::FixtureSet.identify(:purpose_attributes_key) %>
\ No newline at end of file
diff --git a/test/fixtures/models/katello_purpose_addons.yml b/test/fixtures/models/katello_purpose_addons.yml
deleted file mode 100644
index f618ff2efd2..00000000000
--- a/test/fixtures/models/katello_purpose_addons.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-addon:
- name: "Test Addon"
diff --git a/test/models/activation_key_test.rb b/test/models/activation_key_test.rb
index 59605f18bfb..7938cd65026 100644
--- a/test/models/activation_key_test.rb
+++ b/test/models/activation_key_test.rb
@@ -206,12 +206,6 @@ def test_search_role
assert_includes activation_keys, @purpose_key
end
- def test_search_addon
- @purpose_key.purpose_addons << katello_purpose_addons(:addon)
- activation_keys = ActivationKey.search_for("addon = \"Test Addon\"")
- assert_includes activation_keys, @purpose_key
- end
-
def test_search_usage
activation_keys = ActivationKey.search_for("usage = \"#{@purpose_key.purpose_usage}\"")
assert_includes activation_keys, @purpose_key
diff --git a/test/models/association_test.rb b/test/models/association_test.rb
index 50f69626faa..da884139168 100644
--- a/test/models/association_test.rb
+++ b/test/models/association_test.rb
@@ -67,7 +67,7 @@ def self.ignorable_models
"Katello::SmartProxySyncHistory",
"Katello::SubscriptionFacetActivationKey",
"Katello::SubscriptionFacetInstalledProduct",
- "Katello::SubscriptionFacetPurposeAddon",
+ "Katello::SubscriptionFacetInstalledProduct",
]
end
diff --git a/test/models/concerns/host_managed_extensions_test.rb b/test/models/concerns/host_managed_extensions_test.rb
index 7f4fc70f736..ae6227ea8a3 100644
--- a/test/models/concerns/host_managed_extensions_test.rb
+++ b/test/models/concerns/host_managed_extensions_test.rb
@@ -298,16 +298,6 @@ def test_backend_update_needed?
assert subscription_facet.backend_update_needed?
end
- def test_backend_update_needed_purpose_addons?
- host = FactoryBot.create(:host, :with_content, :with_subscription, :content_view => @library_view, :lifecycle_environment => @library)
- subscription_facet = host.subscription_facet
- host.content_facet.cves_changed = false
- refute host.subscription_facet.backend_update_needed?
-
- subscription_facet.purpose_addon_ids = [katello_purpose_addons(:addon).id]
- assert host.subscription_facet.backend_update_needed?
- end
-
def test_host_update_with_overridden_dmi_uuid
::Setting[:host_dmi_uuid_duplicates] = ['duplicate-dmi-uuid']
params = {facts: {'dmi.system.uuid' => 'duplicate-dmi-uuid'}}.with_indifferent_access
diff --git a/test/models/host/subscription_facet_test.rb b/test/models/host/subscription_facet_test.rb
index d2468a2fefc..3cecda5b9db 100644
--- a/test/models/host/subscription_facet_test.rb
+++ b/test/models/host/subscription_facet_test.rb
@@ -31,11 +31,6 @@ def setup
end
class SubscriptionFacetSystemPurposeTest < SubscriptionFacetBase
- def test_update_addons
- host.subscription_facet.purpose_addons << katello_purpose_addons(:addon)
- assert_valid host.subscription_facet
- end
-
def test_search_role
subscription_facet.update(purpose_role: 'satellite')
assert_includes ::Host.search_for("role = satellite"), host
@@ -54,11 +49,6 @@ def test_convert2rhel_through_foreman_not_on_host
refute_equal 0, host.subscription_facet.convert2rhel_through_foreman
end
- def test_search_addon
- host.subscription_facet.purpose_addons << katello_purpose_addons(:addon)
- assert_includes ::Host.search_for("addon = \"Test Addon\""), host
- end
-
def test_search_usage
subscription_facet.update(purpose_usage: 'disaster recovery')
assert_includes ::Host.search_for('usage = "disaster recovery"'), host
@@ -69,7 +59,7 @@ def test_update_from_consumer_attributes
Katello::Resources::Candlepin::Consumer.stubs(:virtual_host).returns(nil)
# set intial values
- params = { role: 'satellite', usage: 'DR', addOns: ["Test1", "Test2"] }
+ params = { role: 'satellite', usage: 'DR' }
subscription_facet.update_from_consumer_attributes(params.with_indifferent_access)
# purpose attributes are preserved when not sent to us
@@ -77,14 +67,12 @@ def test_update_from_consumer_attributes
assert_equal params[:role], subscription_facet.purpose_role
assert_equal params[:usage], subscription_facet.purpose_usage
- assert_equal params[:addOns], subscription_facet.purpose_addons.pluck(:name)
# purpose attributes can be cleared
- subscription_facet.update_from_consumer_attributes({role: '', usage: '', addOns: []}.with_indifferent_access)
+ subscription_facet.update_from_consumer_attributes({role: '', usage: ''}.with_indifferent_access)
assert_empty subscription_facet.purpose_role
assert_empty subscription_facet.purpose_usage
- assert_empty subscription_facet.purpose_addons
end
end
diff --git a/test/support/fixtures_support.rb b/test/support/fixtures_support.rb
index 8fb2249b2da..8704650c837 100644
--- a/test/support/fixtures_support.rb
+++ b/test/support/fixtures_support.rb
@@ -2,7 +2,6 @@ module Katello
module FixturesSupport
FIXTURE_CLASSES = {
:katello_activation_keys => Katello::ActivationKey,
- :katello_activation_key_purpose_addons => Katello::ActivationKeyPurposeAddon,
:katello_alternate_content_sources => Katello::AlternateContentSource,
:katello_cdn_configurations => Katello::CdnConfiguration,
:katello_contents => Katello::Content,
@@ -31,7 +30,6 @@ module FixturesSupport
:katello_pool_products => Katello::PoolProduct,
:katello_product_contents => Katello::ProductContent,
:katello_providers => Katello::Provider,
- :katello_purpose_addons => Katello::PurposeAddon,
:katello_root_repositories => Katello::RootRepository,
:katello_repositories => Katello::Repository,
:katello_sync_plans => Katello::SyncPlan,
diff --git a/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeCard.js b/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeCard.js
index 7d790913732..f0e534b7073 100644
--- a/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeCard.js
+++ b/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeCard.js
@@ -17,8 +17,6 @@ import {
FlexItem,
GridItem,
Label,
- List,
- ListItem,
Tooltip,
Skeleton,
CardExpandableContent,
@@ -41,12 +39,11 @@ const SystemPurposeCard = ({ hostDetails, akDetails }) => {
const { organization_id: orgId, name } = details;
const subscriptionFacetAttributes = details?.subscription_facet_attributes;
const {
- purposeRole, purposeUsage, purposeAddons, releaseVersion, serviceLevel,
+ purposeRole, purposeUsage, releaseVersion, serviceLevel,
} = propsToCamelCase((subscriptionFacetAttributes || details) ?? {});
const sysPurposeProps = {
purposeRole,
purposeUsage,
- purposeAddons,
releaseVersion,
serviceLevel,
};
@@ -142,21 +139,6 @@ const SystemPurposeCard = ({ hostDetails, akDetails }) => {
{dataIsLoading ? : releaseVersion}
- {!!purposeAddons?.length && (
- <>
- {__('Add-ons')}
- {dataIsLoading ? : (
-
-
- {purposeAddons.map(addon => (
- {addon}
- ))}
-
-
- )}
- >
- )
- }
{showEditButton && (
@@ -201,7 +183,6 @@ SystemPurposeCard.propTypes = {
purpose_role: PropTypes.string,
release_version: PropTypes.string,
service_level: PropTypes.string,
- purpose_addons: PropTypes.arrayOf(PropTypes.string),
permissions: PropTypes.shape({
edit_activation_keys: PropTypes.bool,
}),
diff --git a/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeEditModal.js b/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeEditModal.js
index fcf792ac7e0..e1b35ddc8a2 100644
--- a/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeEditModal.js
+++ b/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeEditModal.js
@@ -1,6 +1,5 @@
import React, { useState, useEffect } from 'react';
import { useSelector, useDispatch } from 'react-redux';
-import { isEqual } from 'lodash';
import PropTypes from 'prop-types';
import { STATUS } from 'foremanReact/constants';
import { propsToCamelCase } from 'foremanReact/common/helpers';
@@ -11,9 +10,6 @@ import {
FormGroup,
FormSelect,
FormSelectOption,
- Select,
- SelectOption,
- SelectVariant,
} from '@patternfly/react-core';
import { FormattedMessage } from 'react-intl';
import { translate as __ } from 'foremanReact/common/I18n';
@@ -29,27 +25,23 @@ import { defaultUsages, defaultRoles, defaultServiceLevels } from './SystemPurpo
import { getActivationKey } from '../../../../../scenes/ActivationKeys/Details/ActivationKeyActions';
const SystemPurposeEditModal = ({
- closeModal, name, purposeRole, purposeUsage, purposeAddons,
+ closeModal, name, purposeRole, purposeUsage,
serviceLevel, releaseVersion, isOpen, orgId, id, type,
}) => {
const initialPurposeRole = purposeRole ?? '';
const initialServiceLevel = serviceLevel ?? '';
const initialPurposeUsage = purposeUsage ?? '';
const initialReleaseVersion = releaseVersion ?? '';
- const initialPurposeAddons = purposeAddons ?? [];
const [selectedRole, setSelectedRole] = useState(initialPurposeRole);
const [selectedServiceLevel, setSelectedServiceLevel] = useState(initialServiceLevel);
const [selectedUsage, setSelectedUsage] = useState(initialPurposeUsage);
- const [addonSelectOpen, setAddonSelectOpen] = useState(false);
- const [selectedAddons, setSelectedAddons] = useState(initialPurposeAddons);
const [selectedReleaseVersion, setSelectedReleaseVersion] = useState(initialReleaseVersion);
const unmodified = (
selectedRole === initialPurposeRole &&
selectedServiceLevel === initialServiceLevel &&
selectedUsage === initialPurposeUsage &&
- selectedReleaseVersion === initialReleaseVersion &&
- isEqual(selectedAddons, initialPurposeAddons)
+ selectedReleaseVersion === initialReleaseVersion
);
const dispatch = useDispatch();
@@ -58,7 +50,7 @@ const SystemPurposeEditModal = ({
const orgDetails = propsToCamelCase(organizationDetails ?? { systemPurposes: {} });
const availableSyspurposeAttributes = orgDetails?.systemPurposes ?? {};
const availableServiceLevels = orgDetails?.serviceLevels ?? [];
- const { addons: availableAddons, roles: availableRoles, usage: availableUsages }
+ const { roles: availableRoles, usage: availableUsages }
= availableSyspurposeAttributes;
const selectorAPIKey = type === 'host' ? 'AVAILABLE_RELEASE_VERSIONS' : 'RELEASES';
@@ -79,19 +71,6 @@ const SystemPurposeEditModal = ({
}
}, [type, id, availableReleaseVersionsStatus, actionToDispatch, dispatch]);
- const toggleAddonSelect = isOpenState => setAddonSelectOpen(isOpenState);
-
- const onAddonSelect = (_event, selected) => {
- const newSelectedAddons = new Set(selectedAddons);
- if (!selected) return;
- if (newSelectedAddons.has(selected)) {
- newSelectedAddons.delete(selected);
- } else {
- newSelectedAddons.add(selected);
- }
- setSelectedAddons([...newSelectedAddons]);
- };
-
const refreshHostDetails = () => dispatch({
type: 'API_GET',
payload: {
@@ -122,14 +101,6 @@ const SystemPurposeEditModal = ({
const usageOptions =
buildOptions(defaultUsages, availableUsages, selectedUsage, purposeUsage);
- // addons may be present on the host but not available from subscriptions,
- // so we combine the options here
- const addonToObject = addon => ({ label: addon, value: addon });
- const addonsOptions =
- [...new Set([ // don't repeat addons if they are already selected
- ...purposeAddons.map(addonToObject), ...availableAddons?.map(addonToObject) ?? [],
- ])];
-
const serviceLevelOptions =
buildOptions(defaultServiceLevels, availableServiceLevels, selectedServiceLevel, serviceLevel);
@@ -148,7 +119,6 @@ const SystemPurposeEditModal = ({
autoheal: true,
purpose_role: optionsToValue(roleOptions, selectedRole),
purpose_usage: optionsToValue(usageOptions, selectedUsage),
- purpose_addons: selectedAddons,
release_version: optionsToValue(releaseVersionOptions, selectedReleaseVersion),
service_level: optionsToValue(serviceLevelOptions, selectedServiceLevel),
},
@@ -161,7 +131,6 @@ const SystemPurposeEditModal = ({
autoheal: true,
purpose_role: optionsToValue(roleOptions, selectedRole),
purpose_usage: optionsToValue(usageOptions, selectedUsage),
- purpose_addons: selectedAddons,
release_version: optionsToValue(releaseVersionOptions, selectedReleaseVersion),
service_level: optionsToValue(serviceLevelOptions, selectedServiceLevel),
},
@@ -174,7 +143,6 @@ const SystemPurposeEditModal = ({
setSelectedRole(initialPurposeRole);
setSelectedServiceLevel(initialServiceLevel);
setSelectedUsage(initialPurposeUsage);
- setSelectedAddons(initialPurposeAddons);
setSelectedReleaseVersion(initialReleaseVersion);
closeModal();
};
@@ -277,31 +245,6 @@ const SystemPurposeEditModal = ({
))}
-
-
- Checkbox Title
-
-
-
);
@@ -314,7 +257,6 @@ SystemPurposeEditModal.propTypes = {
name: PropTypes.string,
purposeRole: PropTypes.string.isRequired,
purposeUsage: PropTypes.string.isRequired,
- purposeAddons: PropTypes.arrayOf(PropTypes.string).isRequired,
serviceLevel: PropTypes.string.isRequired,
releaseVersion: PropTypes.string,
isOpen: PropTypes.bool.isRequired,
diff --git a/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/__tests__/SystemPurposeCard.test.js b/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/__tests__/SystemPurposeCard.test.js
index fc30b09d513..ad31a4d5aac 100644
--- a/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/__tests__/SystemPurposeCard.test.js
+++ b/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/__tests__/SystemPurposeCard.test.js
@@ -16,7 +16,6 @@ const baseHostDetails = {
edit_hosts: true,
},
subscription_facet_attributes: {
- purpose_addons: ['Addon1', 'Addon2'],
purpose_role: 'Red Hat Enterprise Linux Server',
purpose_usage: 'Production',
service_level: 'Premium',
@@ -61,8 +60,6 @@ test('shows system purpose details for a host', async (done) => {
expect(getByText('Red Hat Enterprise Linux Server')).toBeInTheDocument();
expect(getByText('Production')).toBeInTheDocument();
expect(getByText('Premium')).toBeInTheDocument();
- expect(getByText('Addon1')).toBeInTheDocument();
- expect(getByText('Addon2')).toBeInTheDocument();
expect(getByText('8')).toBeInTheDocument();
assertNockRequest(orgScope);
@@ -77,8 +74,6 @@ test('shows system purpose details for an activation key', () => {
expect(getByText('Red Hat Enterprise Linux Server')).toBeInTheDocument();
expect(getByText('Production')).toBeInTheDocument();
expect(getByText('Premium')).toBeInTheDocument();
- expect(getByText('Addon1')).toBeInTheDocument();
- expect(getByText('Addon2')).toBeInTheDocument();
expect(getByText('8')).toBeInTheDocument();
});
diff --git a/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/__tests__/SystemPurposeEditModal.test.js b/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/__tests__/SystemPurposeEditModal.test.js
index 8967da1f439..1d04620cd02 100644
--- a/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/__tests__/SystemPurposeEditModal.test.js
+++ b/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/__tests__/SystemPurposeEditModal.test.js
@@ -22,7 +22,6 @@ const baseHostDetails = {
edit_hosts: true,
},
subscription_facet_attributes: {
- purpose_addons: ['Addon1', 'Addon2'],
purpose_role: 'Red Hat Enterprise Linux Server',
purpose_usage: 'Production',
service_level: 'Premium',
@@ -85,8 +84,6 @@ describe('SystemPurposeEditModal', () => {
expect(getByText('Red Hat Enterprise Linux Server')).toBeInTheDocument();
expect(getByText('Production')).toBeInTheDocument();
expect(getByText('Premium')).toBeInTheDocument();
- expect(getByText('Addon1')).toBeInTheDocument();
- expect(getByText('Addon2')).toBeInTheDocument();
expect(getByText('8')).toBeInTheDocument();
assertNockRequest(orgScope);
@@ -136,7 +133,6 @@ describe('SystemPurposeEditModal', () => {
// we're going to change role from 'Server' to 'Workstation'
purpose_role: 'Red Hat Enterprise Linux Workstation',
purpose_usage: 'Production',
- purpose_addons: ['Addon1', 'Addon2'],
release_version: '8',
service_level: 'Premium',
},
@@ -191,7 +187,6 @@ describe('SystemPurposeEditModal', () => {
autoheal: true,
purpose_role: 'Red Hat Enterprise Linux Workstation',
purpose_usage: 'Production',
- purpose_addons: ['Addon1', 'Addon2'],
release_version: '8',
service_level: 'Premium',
},
diff --git a/webpack/scenes/ContentViews/Delete/__tests__/affectedHosts.fixtures.json b/webpack/scenes/ContentViews/Delete/__tests__/affectedHosts.fixtures.json
index 74307d28249..dfac7a6ff42 100644
--- a/webpack/scenes/ContentViews/Delete/__tests__/affectedHosts.fixtures.json
+++ b/webpack/scenes/ContentViews/Delete/__tests__/affectedHosts.fixtures.json
@@ -134,8 +134,7 @@
"purpose_role": "",
"purpose_usage": "",
"hypervisor": false,
- "user": null,
- "purpose_addons": []
+ "user": null
}
}
]
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 91e663d2733..02da24c04c8 100644
--- a/webpack/scenes/ContentViews/Details/Versions/BulkDelete/__tests__/hosts.fixtures.json
+++ b/webpack/scenes/ContentViews/Details/Versions/BulkDelete/__tests__/hosts.fixtures.json
@@ -138,8 +138,7 @@
"purpose_role": "",
"purpose_usage": "",
"hypervisor": false,
- "user": null,
- "purpose_addons": []
+ "user": null
},
"infrastructure_facet": {
"foreman_instance": false,
diff --git a/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvAffectedActivationKeys.fixture.json b/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvAffectedActivationKeys.fixture.json
index acede8a5455..6089f9cf23a 100644
--- a/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvAffectedActivationKeys.fixture.json
+++ b/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvAffectedActivationKeys.fixture.json
@@ -42,7 +42,6 @@
},
"products": [],
"host_collections": [],
- "purpose_addons": [],
"permissions": {
"view_activation_keys": true,
"edit_activation_keys": true,
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 df135afff44..4aaba0fc0bc 100644
--- a/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvAffectedHosts.fixture.json
+++ b/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvAffectedHosts.fixture.json
@@ -132,8 +132,7 @@
"purpose_role": "",
"purpose_usage": "",
"hypervisor": false,
- "user": null,
- "purpose_addons": []
+ "user": null
}
}
]
diff --git a/webpack/scenes/Subscriptions/Details/SubscriptionPurposeAttributes.js b/webpack/scenes/Subscriptions/Details/SubscriptionPurposeAttributes.js
index ede163dd75e..0252547fb88 100644
--- a/webpack/scenes/Subscriptions/Details/SubscriptionPurposeAttributes.js
+++ b/webpack/scenes/Subscriptions/Details/SubscriptionPurposeAttributes.js
@@ -4,5 +4,4 @@ export default {
support_level: __('Service Level (SLA)'),
usage: __('Usage Type'),
roles: __('Roles'),
- addons: __('Add ons'),
};
diff --git a/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailInfo.test.js.snap b/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailInfo.test.js.snap
index a7f59439d6d..d83bc459668 100644
--- a/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailInfo.test.js.snap
+++ b/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailInfo.test.js.snap
@@ -220,16 +220,6 @@ exports[`subscriptions detail associations page renders correctly 1`] = `
Test Role
-
-
-
- Add ons
-
- |
-
- Addon1, Addon2
- |
-
diff --git a/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetails.test.js.snap b/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetails.test.js.snap
index c470641b759..c96ac34cd78 100644
--- a/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetails.test.js.snap
+++ b/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetails.test.js.snap
@@ -94,7 +94,6 @@ exports[`subscriptions details page should render and contain appropiate compone
Object {
"account_number": 1212729,
"activation_keys": Array [],
- "addons": "Addon1, Addon2",
"arch": "ia64,ppc,ppc64,ppc64le,s390,s390x,x86,x86_64",
"available": 1,
"consumed": 0,
@@ -235,7 +234,6 @@ exports[`subscriptions details page should render and contain appropiate compone
Object {
"account_number": 1212729,
"activation_keys": Array [],
- "addons": "Addon1, Addon2",
"arch": "ia64,ppc,ppc64,ppc64le,s390,s390x,x86,x86_64",
"available": 1,
"consumed": 0,
@@ -370,7 +368,6 @@ exports[`subscriptions details page should render and contain appropiate compone
Object {
"account_number": 1212729,
"activation_keys": Array [],
- "addons": "Addon1, Addon2",
"arch": "ia64,ppc,ppc64,ppc64le,s390,s390x,x86,x86_64",
"available": 1,
"consumed": 0,
diff --git a/webpack/scenes/Subscriptions/Details/__tests__/subscriptionDetails.fixtures.js b/webpack/scenes/Subscriptions/Details/__tests__/subscriptionDetails.fixtures.js
index 26f0b432c40..8b2e496d056 100644
--- a/webpack/scenes/Subscriptions/Details/__tests__/subscriptionDetails.fixtures.js
+++ b/webpack/scenes/Subscriptions/Details/__tests__/subscriptionDetails.fixtures.js
@@ -27,7 +27,6 @@ export const subDetails = Immutable({
support_type: 'L1-L3',
roles: 'Test Role',
usage: ' Development',
- addons: 'Addon1, Addon2',
id: 48,
cp_id: '4028f92a6317cfbd0163b419377f3bee',
subscription_id: 3,