Sha256: 333615dbacd19a228d8213f4143f53321225a5b5195903f6653676378cef1764
Contents?: true
Size: 1.23 KB
Versions: 14
Compression:
Stored size: 1.23 KB
Contents
module Katello class ProductContentFinder attr_accessor :match_environment, :match_subscription, :consumable #consumable must implement: # content_view # lifecycle_environment # organization # products def initialize(params = {}) self.match_subscription = false self.match_environment = false params.each_pair { |k, v| instance_variable_set("@#{k}", v) unless v.nil? } end def product_content if match_environment environment = consumable.lifecycle_environment view = consumable.content_view return [] unless environment && view version = ContentViewVersion.in_environment(environment).where(:content_view_id => view).first end considered_products = match_subscription ? consumable.products : consumable.organization.products.enabled.uniq repositories = Katello::Repository.where(:product_id => considered_products).subscribable repositories = repositories.where(:content_view_version_id => version.id) if version consumable.organization.enabled_product_content_for(repositories) end def presenter_with_overrides(overrides) product_content.map { |pc| ProductContentPresenter.new(pc, overrides) } end end end
Version data entries
14 entries across 14 versions & 1 rubygems