diff --git a/app/models/ext_management_system.rb b/app/models/ext_management_system.rb index 930f5230df3e..1b4e6adab0c9 100644 --- a/app/models/ext_management_system.rb +++ b/app/models/ext_management_system.rb @@ -22,17 +22,15 @@ def self.leaf_subclasses end def self.supported_subclasses - subclasses.flat_map do |s| - s.subclasses.empty? ? s : s.supported_subclasses - end + leaf_subclasses.select(&:supported?) + end + + def self.supported? + Vmdb::PermissionStores.instance.supported_ems_type?(ems_type) end def self.supported_types_and_descriptions_hash - supported_subclasses.each_with_object({}) do |klass, hash| - if Vmdb::PermissionStores.instance.supported_ems_type?(klass.ems_type) - hash[klass.ems_type] = klass.description - end - end + supported_subclasses.each_with_object({}) { |klass, hash| hash[klass.ems_type] = klass.description } end def self.api_allowed_attributes diff --git a/app/models/service_template.rb b/app/models/service_template.rb index 07be67c543bb..5dac71d1f23b 100644 --- a/app/models/service_template.rb +++ b/app/models/service_template.rb @@ -104,7 +104,7 @@ def self.with_additional_tenants end def self.catalog_item_types - ci_types = Set.new(Rbac.filtered(ExtManagementSystem.all).flat_map(&:supported_catalog_types)) + ci_types = Set.new(Rbac.filtered(ExtManagementSystem.supported_subclasses).flat_map(&:supported_catalog_types)) ci_types.add('generic_orchestration') if Rbac.filtered(OrchestrationTemplate).exists? ci_types.add('generic') CATALOG_ITEM_TYPES.each.with_object({}) do |(key, description), hash|