Sha256: 6f34d0bc2823672d425b91ba0c549a5c1842a6505fa95fd608815b69758786b1

Contents?: true

Size: 1.32 KB

Versions: 16

Compression:

Stored size: 1.32 KB

Contents

module Katello
  module Glue::Candlepin::Content
    CANDLEPIN_DOCKER_TYPE = "containerimage".freeze
    CANDLEPIN_OSTREE_TYPE = "ostree".freeze

    def self.included(base)
      base.send :include, InstanceMethods
      # required for GPG key url generation
      base.send :include, Rails.application.routes.url_helpers
    end

    module InstanceMethods
      def content
        return @content unless @content.nil?
        unless self.content_id.nil?
          @content = Katello::Candlepin::Content.find(self.organization.label, self.content_id)
        end
        @content
      rescue RestClient::ResourceNotFound, RestClient::BadRequest
        nil
      end

      def should_update_content?
        (self.gpg_key_id_was.nil? && !self.gpg_key_id.nil? && self.content.gpgUrl == '') ||
            (!self.gpg_key_id_was.nil? && self.gpg_key_id.nil? && self.content.gpgUrl != '')
      end

      def yum_gpg_key_url
        # if the repo has a gpg key return a url to access it
        if (gpg_key && gpg_key.content.present?)
          host = Facter.value(:fqdn) || SETTINGS[:fqdn]
          gpg_key_content_api_repository_url(self, :host => host + "/katello", :protocol => 'https')
        end
      end

      def custom_content_label
        "#{organization.label} #{product.label} #{label}".gsub(/\s/, "_")
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
katello-3.5.2 app/models/katello/glue/candlepin/content.rb
katello-3.5.1.1 app/models/katello/glue/candlepin/content.rb
katello-3.5.1 app/models/katello/glue/candlepin/content.rb
katello-3.5.0.1 app/models/katello/glue/candlepin/content.rb
katello-3.5.0 app/models/katello/glue/candlepin/content.rb
katello-3.5.0.rc2 app/models/katello/glue/candlepin/content.rb
katello-3.5.0.rc1 app/models/katello/glue/candlepin/content.rb
katello-3.4.5 app/models/katello/glue/candlepin/content.rb
katello-3.4.4 app/models/katello/glue/candlepin/content.rb
katello-3.4.2 app/models/katello/glue/candlepin/content.rb
katello-3.4.1 app/models/katello/glue/candlepin/content.rb
katello-3.4.0.2 app/models/katello/glue/candlepin/content.rb
katello-3.4.0.1 app/models/katello/glue/candlepin/content.rb
katello-3.4.0 app/models/katello/glue/candlepin/content.rb
katello-3.4.0.rc2 app/models/katello/glue/candlepin/content.rb
katello-3.4.0.rc1 app/models/katello/glue/candlepin/content.rb