Skip to content

Commit

Permalink
promote SupportsFeatureMixin to a global phenomenon
Browse files Browse the repository at this point in the history
Adding supports feature to a few more core models.
It makes sense to have this as a base class for all
  • Loading branch information
kbrock committed Aug 22, 2024
1 parent a04c02d commit bfbecf9
Show file tree
Hide file tree
Showing 64 changed files with 1 addition and 73 deletions.
1 change: 1 addition & 0 deletions app/models/application_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class ApplicationRecord < ActiveRecord::Base
include ArHrefSlug
include ToModelHash
include ArVisibleAttribute
include SupportsFeatureMixin

extend ArTableLock
extend ArReferences
Expand Down
1 change: 0 additions & 1 deletion app/models/authentication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class Authentication < ApplicationRecord
acts_as_miq_taggable
include ImportExport
include YamlImportExportMixin
include SupportsFeatureMixin
include NewWithTypeStiMixin
def self.new(*args, &block)
if self == Authentication && (args.empty? || args.first.kind_of?(Hash))
Expand Down
1 change: 0 additions & 1 deletion app/models/availability_zone.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class AvailabilityZone < ApplicationRecord
include SupportsFeatureMixin
include NewWithTypeStiMixin
include Metric::CiMixin
include EventMixin
Expand Down
1 change: 0 additions & 1 deletion app/models/cloud_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class CloudDatabase < ApplicationRecord
include AsyncDeleteMixin
include NewWithTypeStiMixin
include ProviderObjectMixin
include SupportsFeatureMixin

belongs_to :ext_management_system, :foreign_key => :ems_id, :class_name => "ManageIQ::Providers::CloudManager"
belongs_to :cloud_tenant
Expand Down
1 change: 0 additions & 1 deletion app/models/cloud_network.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class CloudNetwork < ApplicationRecord
include NewWithTypeStiMixin
include SupportsFeatureMixin
include CloudTenancyMixin
include CustomActionsMixin

Expand Down
1 change: 0 additions & 1 deletion app/models/cloud_object_store_container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class CloudObjectStoreContainer < ApplicationRecord
include ProviderObjectMixin
include NewWithTypeStiMixin
include ProcessTasksMixin
include SupportsFeatureMixin
include CustomActionsMixin

include Operations
Expand Down
1 change: 0 additions & 1 deletion app/models/cloud_object_store_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class CloudObjectStoreObject < ApplicationRecord
include ProviderObjectMixin
include NewWithTypeStiMixin
include ProcessTasksMixin
include SupportsFeatureMixin

include Operations

Expand Down
1 change: 0 additions & 1 deletion app/models/cloud_subnet.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class CloudSubnet < ApplicationRecord
include NewWithTypeStiMixin
include SupportsFeatureMixin
include CloudTenancyMixin
include CustomActionsMixin

Expand Down
1 change: 0 additions & 1 deletion app/models/cloud_volume.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class CloudVolume < ApplicationRecord
include NewWithTypeStiMixin
include ProviderObjectMixin
include AsyncDeleteMixin
include SupportsFeatureMixin
include CloudTenancyMixin
include CustomActionsMixin
include EmsRefreshMixin
Expand Down
1 change: 0 additions & 1 deletion app/models/cloud_volume_backup.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class CloudVolumeBackup < ApplicationRecord
include NewWithTypeStiMixin
include ProviderObjectMixin
include SupportsFeatureMixin
include CloudTenancyMixin

acts_as_miq_taggable
Expand Down
1 change: 0 additions & 1 deletion app/models/cloud_volume_snapshot.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class CloudVolumeSnapshot < ApplicationRecord
include NewWithTypeStiMixin
include ProviderObjectMixin
include SupportsFeatureMixin
include CloudTenancyMixin
include CustomActionsMixin
include EmsRefreshMixin
Expand Down
1 change: 0 additions & 1 deletion app/models/configuration_profile.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class ConfigurationProfile < ApplicationRecord
include NewWithTypeStiMixin
include SupportsFeatureMixin

acts_as_miq_taggable
belongs_to :manager, :class_name => 'ExtManagementSystem'
Expand Down
1 change: 0 additions & 1 deletion app/models/configuration_script_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ class ConfigurationScriptBase < ApplicationRecord
scope :with_manager, ->(manager_id) { where(:manager_id => manager_id) }

include ProviderObjectMixin
include SupportsFeatureMixin
end
2 changes: 0 additions & 2 deletions app/models/configuration_script_source.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
class ConfigurationScriptSource < ApplicationRecord
acts_as_miq_taggable

include SupportsFeatureMixin

has_many :configuration_script_payloads, :dependent => :destroy
belongs_to :authentication
belongs_to :manager, :class_name => "ExtManagementSystem"
Expand Down
1 change: 0 additions & 1 deletion app/models/configured_system.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class ConfiguredSystem < ApplicationRecord
include NewWithTypeStiMixin
include SupportsFeatureMixin
include CustomAttributeMixin

acts_as_miq_taggable
Expand Down
1 change: 0 additions & 1 deletion app/models/container.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Container < ApplicationRecord
include SupportsFeatureMixin
include NewWithTypeStiMixin
include ArchivedMixin
include Purging
Expand Down
1 change: 0 additions & 1 deletion app/models/container_group.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class ContainerGroup < ApplicationRecord
acts_as_miq_taggable

include SupportsFeatureMixin
include ComplianceMixin
include CustomAttributeMixin
include MiqPolicyMixin
Expand Down
1 change: 0 additions & 1 deletion app/models/container_image.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class ContainerImage < ApplicationRecord
acts_as_miq_taggable

include SupportsFeatureMixin
include ComplianceMixin
include MiqPolicyMixin
include ScanningMixin
Expand Down
2 changes: 0 additions & 2 deletions app/models/container_node.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
class ContainerNode < ApplicationRecord
acts_as_miq_taggable

include SupportsFeatureMixin
include ComplianceMixin
include MiqPolicyMixin
include NewWithTypeStiMixin
include TenantIdentityMixin
include SupportsFeatureMixin
include ArchivedMixin
include CustomActionsMixin
include Purging
Expand Down
1 change: 0 additions & 1 deletion app/models/container_project.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class ContainerProject < ApplicationRecord
acts_as_miq_taggable

include SupportsFeatureMixin
include CustomAttributeMixin
include ArchivedMixin
include MiqPolicyMixin
Expand Down
1 change: 0 additions & 1 deletion app/models/container_replicator.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class ContainerReplicator < ApplicationRecord
acts_as_miq_taggable

include SupportsFeatureMixin
include ComplianceMixin
include CustomAttributeMixin
include MiqPolicyMixin
Expand Down
1 change: 0 additions & 1 deletion app/models/container_service.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class ContainerService < ApplicationRecord
include CustomAttributeMixin
include SupportsFeatureMixin
# :name, :uid, :creation_timestamp, :resource_version, :namespace
# :labels, :selector, :protocol, :port, :container_port, :portal_ip, :session_affinity

Expand Down
1 change: 0 additions & 1 deletion app/models/container_template.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class ContainerTemplate < ApplicationRecord
include CustomAttributeMixin
include CustomActionsMixin
include SupportsFeatureMixin

belongs_to :ext_management_system, :foreign_key => "ems_id"
belongs_to :container_project
Expand Down
1 change: 0 additions & 1 deletion app/models/ems_cluster.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class EmsCluster < ApplicationRecord
include SupportsFeatureMixin
include NewWithTypeStiMixin
include EventMixin
include TenantIdentityMixin
Expand Down
2 changes: 0 additions & 2 deletions app/models/ext_management_system.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class ExtManagementSystem < ApplicationRecord
include CustomActionsMixin
include SupportsFeatureMixin
include ExternalUrlMixin
include VerifyCredentialsMixin
include SupportsAttribute
Expand Down Expand Up @@ -200,7 +199,6 @@ def validate_zone_not_maintenance_when_ems_enabled?
include UuidMixin
include EmsRefresh::Manager
include TenancyMixin
include SupportsFeatureMixin
include ComplianceMixin
include CustomAttributeMixin

Expand Down
1 change: 0 additions & 1 deletion app/models/flavor.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class Flavor < ApplicationRecord
include NewWithTypeStiMixin
include CloudTenancyMixin
include SupportsFeatureMixin

acts_as_miq_taggable

Expand Down
1 change: 0 additions & 1 deletion app/models/floating_ip.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class FloatingIp < ApplicationRecord
include NewWithTypeStiMixin
include SupportsFeatureMixin
include CloudTenancyMixin

acts_as_miq_taggable
Expand Down
1 change: 0 additions & 1 deletion app/models/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
require 'metadata/ScanProfile/HostScanProfiles'

class Host < ApplicationRecord
include SupportsFeatureMixin
include NewWithTypeStiMixin
include TenantIdentityMixin
include DeprecationMixin
Expand Down
1 change: 0 additions & 1 deletion app/models/host_aggregate.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class HostAggregate < ApplicationRecord
include SupportsFeatureMixin
include NewWithTypeStiMixin
include Metric::CiMixin
include EventMixin
Expand Down
1 change: 0 additions & 1 deletion app/models/host_initiator.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class HostInitiator < ApplicationRecord
include NewWithTypeStiMixin
include ProviderObjectMixin
include SupportsFeatureMixin
include CustomActionsMixin
include EmsRefreshMixin

Expand Down
1 change: 0 additions & 1 deletion app/models/host_initiator_group.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class HostInitiatorGroup < ApplicationRecord
include NewWithTypeStiMixin
include ProviderObjectMixin
include SupportsFeatureMixin
include CustomActionsMixin
include EmsRefreshMixin

Expand Down
1 change: 0 additions & 1 deletion app/models/manageiq/providers/container_manager.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module ManageIQ::Providers
class ContainerManager < BaseManager
include SupportsFeatureMixin

has_many :container_nodes, -> { active }, # rubocop:disable Rails/HasManyOrHasOneDependent
:foreign_key => :ems_id,
Expand Down
2 changes: 0 additions & 2 deletions app/models/manageiq/providers/infra_manager.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module ManageIQ::Providers
class InfraManager < BaseManager
include SupportsFeatureMixin

has_many :distributed_virtual_switches, :dependent => :destroy, :foreign_key => :ems_id, :inverse_of => :ext_management_system
has_many :distributed_virtual_lans, -> { distinct }, :through => :distributed_virtual_switches, :source => :lans
has_many :host_virtual_switches, -> { distinct }, :through => :hosts
Expand Down
2 changes: 0 additions & 2 deletions app/models/manageiq/providers/network_manager.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module ManageIQ::Providers
class NetworkManager < BaseManager
include SupportsFeatureMixin

PROVIDER_NAME = "Network Manager".freeze

class << model_name
Expand Down
2 changes: 0 additions & 2 deletions app/models/manageiq/providers/physical_infra_manager.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module ManageIQ::Providers
class PhysicalInfraManager < BaseManager
include SupportsFeatureMixin

has_many :physical_chassis, :foreign_key => "ems_id", :dependent => :destroy, :inverse_of => :ext_management_system
has_many :physical_racks, :foreign_key => "ems_id", :dependent => :destroy, :inverse_of => :ext_management_system
has_many :physical_servers, :foreign_key => "ems_id", :dependent => :destroy, :inverse_of => :ext_management_system
Expand Down
2 changes: 0 additions & 2 deletions app/models/manageiq/providers/storage_manager.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module ManageIQ::Providers
class StorageManager < ManageIQ::Providers::BaseManager
include SupportsFeatureMixin

has_many :cloud_tenants, :foreign_key => :ems_id, :dependent => :destroy
has_many :volume_availability_zones, :class_name => "AvailabilityZone", :foreign_key => :ems_id, :dependent => :destroy

Expand Down
1 change: 0 additions & 1 deletion app/models/miq_enterprise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class MiqEnterprise < ApplicationRecord

acts_as_miq_taggable

include SupportsFeatureMixin
include MiqPolicyMixin
include Metric::CiMixin

Expand Down
1 change: 0 additions & 1 deletion app/models/miq_region.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class MiqRegion < ApplicationRecord
include ConfigurationManagementMixin

include MiqPolicyMixin
include SupportsFeatureMixin
include Metric::CiMixin

alias_method :all_storages, :storages
Expand Down
1 change: 0 additions & 1 deletion app/models/network_router.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class NetworkRouter < ApplicationRecord
include NewWithTypeStiMixin
include SupportsFeatureMixin
include CloudTenancyMixin
include CustomActionsMixin

Expand Down
1 change: 0 additions & 1 deletion app/models/network_service.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class NetworkService < ApplicationRecord
include NewWithTypeStiMixin
include SupportsFeatureMixin
include CloudTenancyMixin
include CustomActionsMixin

Expand Down
1 change: 0 additions & 1 deletion app/models/network_service_entry.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class NetworkServiceEntry < ApplicationRecord
include NewWithTypeStiMixin
include SupportsFeatureMixin
include CloudTenancyMixin
include CustomActionsMixin

Expand Down
1 change: 0 additions & 1 deletion app/models/orchestration_stack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class OrchestrationStack < ApplicationRecord
include RetirementMixin
include TenantIdentityMixin
include CustomActionsMixin
include SupportsFeatureMixin
include CiFeatureMixin
include CloudTenancyMixin
include EmsRefreshMixin
Expand Down
1 change: 0 additions & 1 deletion app/models/orchestration_template.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'digest/md5'
class OrchestrationTemplate < ApplicationRecord
include SupportsFeatureMixin
include NewWithTypeStiMixin

acts_as_miq_taggable
Expand Down
1 change: 0 additions & 1 deletion app/models/physical_chassis.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class PhysicalChassis < ApplicationRecord
include SupportsFeatureMixin
include EventMixin
include EmsRefreshMixin
include CustomActionsMixin
Expand Down
1 change: 0 additions & 1 deletion app/models/physical_rack.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class PhysicalRack < ApplicationRecord
include SupportsFeatureMixin
include EmsRefreshMixin
include CustomActionsMixin

Expand Down
1 change: 0 additions & 1 deletion app/models/physical_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class PhysicalServer < ApplicationRecord
include NewWithTypeStiMixin
include MiqPolicyMixin
include TenantIdentityMixin
include SupportsFeatureMixin
include EventMixin
include ProviderObjectMixin
include ComplianceMixin
Expand Down
1 change: 0 additions & 1 deletion app/models/physical_server_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ class PhysicalServerProfile < ApplicationRecord

include NewWithTypeStiMixin
include TenantIdentityMixin
include SupportsFeatureMixin
include EventMixin
include ProviderObjectMixin
include EmsRefreshMixin
Expand Down
1 change: 0 additions & 1 deletion app/models/physical_server_profile_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ class PhysicalServerProfileTemplate < ApplicationRecord

include NewWithTypeStiMixin
include TenantIdentityMixin
include SupportsFeatureMixin
include ProviderObjectMixin
include EmsRefreshMixin

Expand Down
2 changes: 0 additions & 2 deletions app/models/physical_storage.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
class PhysicalStorage < ApplicationRecord
include SupportsFeatureMixin
include NewWithTypeStiMixin
include ProviderObjectMixin
include SupportsFeatureMixin
include CustomActionsMixin
include EmsRefreshMixin
include EventMixin
Expand Down
1 change: 0 additions & 1 deletion app/models/physical_storage_family.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class PhysicalStorageFamily < ApplicationRecord
include ProviderObjectMixin
include SupportsFeatureMixin

belongs_to :ext_management_system, :foreign_key => :ems_id
has_many :physical_storages, :dependent => :nullify
Expand Down
1 change: 0 additions & 1 deletion app/models/physical_switch.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class PhysicalSwitch < Switch
include SupportsFeatureMixin
include EventMixin
include EmsRefreshMixin

Expand Down
Loading

0 comments on commit bfbecf9

Please sign in to comment.