Module: Katello::Glue::Provider
- Included in:
- Provider
- Defined in:
- app/models/katello/glue/provider.rb
Defined Under Namespace
Modules: InstanceMethods
Constant Summary collapse
- DISTRIBUTOR_VERSION =
'sat-6.10'.freeze
Class Method Summary collapse
- .included(base) ⇒ Object
- .orphaned_custom_product?(cp_id, organization) ⇒ Boolean
- .orphaned_product?(cp_id, organization) ⇒ Boolean
- .provider_for_cp_id(cp_id:, organization:) ⇒ Object
Class Method Details
.included(base) ⇒ Object
5 6 7 |
# File 'app/models/katello/glue/provider.rb', line 5 def self.included(base) base.send :include, InstanceMethods end |
.orphaned_custom_product?(cp_id, organization) ⇒ Boolean
9 10 11 12 13 14 15 16 17 18 |
# File 'app/models/katello/glue/provider.rb', line 9 def self.orphaned_custom_product?(cp_id, organization) return unless cp_id.present? && orphaned_product?(cp_id, organization) product_provider = provider_for_cp_id(cp_id: cp_id, organization: organization) if product_provider.redhat_provider? false else Rails.logger.warn "Found orphaned object with id #{cp_id} in Candlepin. Skipping import into Katello; run rake katello:clean_candlepin_orphaned_products to remove it from Candlepin." true end end |
.orphaned_product?(cp_id, organization) ⇒ Boolean
20 21 22 |
# File 'app/models/katello/glue/provider.rb', line 20 def self.orphaned_product?(cp_id, organization) !organization.products.where(:cp_id => cp_id).exists? end |
.provider_for_cp_id(cp_id:, organization:) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'app/models/katello/glue/provider.rb', line 24 def self.provider_for_cp_id(cp_id:, organization:) return organization.redhat_provider unless ::Katello::Glue::Candlepin::Product.engineering_product_id?(cp_id) if ::Katello::Glue::Candlepin::Product.custom_product_id?(cp_id) organization.anonymous_provider else organization.redhat_provider end end |