Sha256: 8ebc2b4413e020624af309f1ab92bfe0a4259ad347586d58e8e2bceae53b9c6d

Contents?: true

Size: 1.33 KB

Versions: 27

Compression:

Stored size: 1.33 KB

Contents

module Katello
  class Candlepin::ProductContent
    include ForemanTasks::Triggers

    attr_accessor :content, :enabled, :product

    def initialize(params = {}, product_id = nil)
      params = params.with_indifferent_access
      #controls whether repo is enabled in yum repo file on client
      #  unrelated to enable/disable from katello
      @enabled = params[:enabled]
      @content = Candlepin::Content.new(params[:content])
      @product_id = product_id
    end

    def create
      @content.create
    end

    def destroy
      @content.destroy
    end

    def product
      @product ||= Product.find(@product_id) if @product_id
      @product
    end

    def repositories
      @repos ||= self.product.repos(self.product.organization.library).where(:content_id => self.content.id)
    end

    def content_override(activation_key)
      override = activation_key.content_overrides.find { |pc| pc[:contentLabel] == content.label }
      override.nil? ? 'default' : override[:value]
    end

    def content_type
      self.content.type
    end

    def displayable?
      case content_type
      when ::Katello::Repository::CANDLEPIN_DOCKER_TYPE
        false
      when ::Katello::Repository::CANDLEPIN_OSTREE_TYPE
        ::Katello::RepositoryTypeManager.enabled?(Repository::OSTREE_TYPE)
      else
        true
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
katello-3.3.2 app/models/katello/candlepin/product_content.rb
katello-3.3.1.1 app/models/katello/candlepin/product_content.rb
katello-3.3.1 app/models/katello/candlepin/product_content.rb
katello-3.3.0.1 app/models/katello/candlepin/product_content.rb
katello-3.3.0 app/models/katello/candlepin/product_content.rb
katello-3.3.0.rc2 app/models/katello/candlepin/product_content.rb
katello-3.3.0.rc1.1 app/models/katello/candlepin/product_content.rb
katello-3.3.0.rc1 app/models/katello/candlepin/product_content.rb
katello-3.2.1.1 app/models/katello/candlepin/product_content.rb
katello-3.2.1 app/models/katello/candlepin/product_content.rb
katello-3.2.0 app/models/katello/candlepin/product_content.rb
katello-3.2.0.rc3 app/models/katello/candlepin/product_content.rb
katello-3.2.0.rc2 app/models/katello/candlepin/product_content.rb
katello-3.2.0.rc1.1 app/models/katello/candlepin/product_content.rb
katello-3.2.0.rc1 app/models/katello/candlepin/product_content.rb
katello-3.1.0.1 app/models/katello/candlepin/product_content.rb
katello-3.1.0 app/models/katello/candlepin/product_content.rb
katello-3.1.0.rc2.1 app/models/katello/candlepin/product_content.rb
katello-3.0.2 app/models/katello/candlepin/product_content.rb
katello-3.1.0.rc1 app/models/katello/candlepin/product_content.rb