Sha256: 70ff185ea81dcf75a4fac6e0af10f8dfbb49549d394ba4980b9d16058d198b33

Contents?: true

Size: 1020 Bytes

Versions: 10

Compression:

Stored size: 1020 Bytes

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
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
katello-2.4.5 app/models/katello/candlepin/product_content.rb
katello-2.4.4 app/models/katello/candlepin/product_content.rb
katello-2.4.3 app/models/katello/candlepin/product_content.rb
katello-2.4.2 app/models/katello/candlepin/product_content.rb
katello-3.0.0.rc1 app/models/katello/candlepin/product_content.rb
katello-2.4.1 app/models/katello/candlepin/product_content.rb
katello-2.4.0 app/models/katello/candlepin/product_content.rb
katello-2.4.0.rc3 app/models/katello/candlepin/product_content.rb
katello-2.4.0.rc2 app/models/katello/candlepin/product_content.rb
katello-2.4.0.rc1 app/models/katello/candlepin/product_content.rb