Sha256: 1fa17f1532aced08a1f3993172e16848f32005c58efad8db7d2b293652beeb65

Contents?: true

Size: 1.37 KB

Versions: 53

Compression:

Stored size: 1.37 KB

Contents

module Katello
  class PackageGroup < Katello::Model
    include Concerns::PulpDatabaseUnit

    CONTENT_TYPE = "package_group".freeze
    has_many :roots, :through => :repositories, :class_name => "Katello::RootRepository"

    scoped_search :on => :name, :complete_value => true
    scoped_search :on => :pulp_id, :rename => :id, :complete_value => true

    def repository
      self.repositories.first
    end

    def self.list_by_filter_clauses(clauses)
      package_names = []
      pulp_package_groups = Katello.pulp_server.extensions.package_group.search(Katello::PackageGroup::CONTENT_TYPE, :filters => clauses)
      groupings = [:default_package_names, :conditional_package_names, :optional_package_names, :mandatory_package_names]
      if pulp_package_groups.any?
        pulp_package_groups.flat_map { |group| groupings.each { |grouping| package_names << group[grouping] } }
        package_names.flatten!
      else
        []
      end
    end

    def package_names
      service_class = SmartProxy.pulp_primary!.content_service(CONTENT_TYPE)
      group = service_class.new(self.pulp_id)
      group.default_package_names + group.conditional_package_names + group.optional_package_names + group.mandatory_package_names
    end

    def content_view_filters
      Katello::ContentViewPackageGroupFilterRule.where(uuid: self.pulp_id).eager_load(:filter).map(&:filter)
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
katello-4.7.6 app/models/katello/package_group.rb
katello-4.7.5 app/models/katello/package_group.rb
katello-4.7.4 app/models/katello/package_group.rb
katello-4.7.3 app/models/katello/package_group.rb
katello-4.7.2 app/models/katello/package_group.rb
katello-4.7.1 app/models/katello/package_group.rb
katello-4.6.2.1 app/models/katello/package_group.rb
katello-4.6.2 app/models/katello/package_group.rb
katello-4.7.0 app/models/katello/package_group.rb
katello-4.6.1 app/models/katello/package_group.rb
katello-4.7.0.rc2 app/models/katello/package_group.rb
katello-4.7.0.rc1 app/models/katello/package_group.rb
katello-4.4.2.2 app/models/katello/package_group.rb
katello-4.4.2.1 app/models/katello/package_group.rb
katello-4.4.2 app/models/katello/package_group.rb
katello-4.5.1 app/models/katello/package_group.rb
katello-4.6.0 app/models/katello/package_group.rb
katello-4.6.0.rc2 app/models/katello/package_group.rb
katello-4.6.0.rc1 app/models/katello/package_group.rb
katello-4.5.0 app/models/katello/package_group.rb