Skip to content

Commit

Permalink
Remove hardcoded types in favor of a supports feature check
Browse files Browse the repository at this point in the history
  • Loading branch information
Fryguy committed Aug 26, 2020
1 parent 349f28c commit 9792d9e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
10 changes: 0 additions & 10 deletions app/models/manageiq/providers/cloud_manager/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ def snapshot?
!genealogy_parent.nil?
end

def self.eligible_for_provisioning
super.where(:type => %w(ManageIQ::Providers::Amazon::CloudManager::Template
ManageIQ::Providers::Azure::CloudManager::Template
ManageIQ::Providers::Google::CloudManager::Template
ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::Template
ManageIQ::Providers::Openstack::CloudManager::Template
ManageIQ::Providers::Openstack::CloudManager::VolumeTemplate
ManageIQ::Providers::Openstack::CloudManager::VolumeSnapshotTemplate))
end

def self.class_by_ems(ext_management_system)
ext_management_system.class::Template
end
Expand Down
7 changes: 0 additions & 7 deletions app/models/manageiq/providers/infra_manager/template.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
class ManageIQ::Providers::InfraManager::Template < MiqTemplate
default_value_for :cloud, false

def self.eligible_for_provisioning
super.where(:type => %w(ManageIQ::Providers::Redhat::InfraManager::Template
ManageIQ::Providers::Vmware::InfraManager::Template
ManageIQ::Providers::Microsoft::InfraManager::Template
ManageIQ::Providers::Kubevirt::InfraManager::Template))
end

def self.display_name(number = 1)
n_('Template', 'Templates', number)
end
Expand Down
3 changes: 2 additions & 1 deletion app/models/miq_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def self.supports_kickstart_provisioning?
delegate :supports_kickstart_provisioning?, :to => :class

def self.eligible_for_provisioning
where(arel_table[:ems_id].not_eq(nil))
types = descendants.select(&:supports_provisioning?).map(&:name)
where(:type => types).where.not(:ems_id => nil)
end

def self.without_volume_templates
Expand Down

0 comments on commit 9792d9e

Please sign in to comment.