Sha256: e46977027a25590ba5cd9bbb2052e3ad9909d84f436ad6e30b12394953c2484d

Contents?: true

Size: 1.16 KB

Versions: 19

Compression:

Stored size: 1.16 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
      group = Pulp::PackageGroup.new(self.pulp_id)
      group.default_package_names + group.conditional_package_names + group.optional_package_names + group.mandatory_package_names
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
katello-3.15.3.1 app/models/katello/package_group.rb
katello-3.15.3 app/models/katello/package_group.rb
katello-3.15.2 app/models/katello/package_group.rb
katello-3.16.0.rc2 app/models/katello/package_group.rb
katello-3.15.1.1 app/models/katello/package_group.rb
katello-3.16.0.rc1.1 app/models/katello/package_group.rb
katello-3.15.1 app/models/katello/package_group.rb
katello-3.16.0.rc1 app/models/katello/package_group.rb
katello-3.15.0.1 app/models/katello/package_group.rb
katello-3.15.0 app/models/katello/package_group.rb
katello-3.15.0.rc2 app/models/katello/package_group.rb
katello-3.15.0.rc1.3 app/models/katello/package_group.rb
katello-3.15.0.rc1.2 app/models/katello/package_group.rb
katello-3.15.0.rc1.1 app/models/katello/package_group.rb
katello-3.15.0.rc1 app/models/katello/package_group.rb
katello-3.14.1 app/models/katello/package_group.rb
katello-3.14.0 app/models/katello/package_group.rb
katello-3.14.0.rc2 app/models/katello/package_group.rb
katello-3.14.0.rc1 app/models/katello/package_group.rb