Sha256: 78596dc40b9dcb7a6097f8bb2f7a59b690642a86c5b865188512033b39eb5cb6

Contents?: true

Size: 1.19 KB

Versions: 17

Compression:

Stored size: 1.19 KB

Contents

module Katello
  class ContentViewEnvironmentContentFacet < Katello::Model
    belongs_to :content_view_environment, :class_name => "::Katello::ContentViewEnvironment", :inverse_of => :content_view_environment_content_facets
    belongs_to :content_facet, :class_name => "::Katello::Host::ContentFacet", :inverse_of => :content_view_environment_content_facets

    validates :content_view_environment_id, presence: true
    validates :content_facet_id, presence: true, unless: :new_record?
    validate :ensure_valid_content_source

    def ensure_valid_content_source
      source = self.content_facet&.content_source
      return if source&.pulp_primary? # pulp_primary smart proxy always has all content
      env = self.content_view_environment&.environment
      hostname = self.content_facet&.host&.name
      return unless [source, env].all? { |x| x.present? }
      unless source.lifecycle_environments.include?(env)
        errors.add(:base, _("Host %{hostname}: Cannot add content view environment to content facet. The host's content source '%{content_source}' does not sync lifecycle environment '%{lce}'.") % { hostname: hostname, content_source: source.name, lce: env.name })
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
katello-4.12.1 app/models/katello/content_view_environment_content_facet.rb
katello-4.12.0 app/models/katello/content_view_environment_content_facet.rb
katello-4.12.0.rc3 app/models/katello/content_view_environment_content_facet.rb
katello-4.12.0.rc2 app/models/katello/content_view_environment_content_facet.rb
katello-4.12.0.rc1 app/models/katello/content_view_environment_content_facet.rb
katello-4.11.1 app/models/katello/content_view_environment_content_facet.rb
katello-4.11.0 app/models/katello/content_view_environment_content_facet.rb
katello-4.11.0.rc2 app/models/katello/content_view_environment_content_facet.rb
katello-4.11.0.rc1 app/models/katello/content_view_environment_content_facet.rb
katello-4.10.0 app/models/katello/content_view_environment_content_facet.rb
katello-4.9.2 app/models/katello/content_view_environment_content_facet.rb
katello-4.10.0.rc2 app/models/katello/content_view_environment_content_facet.rb
katello-4.10.0.rc1 app/models/katello/content_view_environment_content_facet.rb
katello-4.9.1 app/models/katello/content_view_environment_content_facet.rb
katello-4.9.0 app/models/katello/content_view_environment_content_facet.rb
katello-4.9.0.rc2 app/models/katello/content_view_environment_content_facet.rb
katello-4.9.0.rc1 app/models/katello/content_view_environment_content_facet.rb