Sha256: 4583036b545d0d74bd7df4e32448bba6d53f1eade9872f18a67c7207c2da9349

Contents?: true

Size: 1.48 KB

Versions: 14

Compression:

Stored size: 1.48 KB

Contents

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

    CONTENT_TYPE = "package_group".freeze

    has_many :repository_package_groups, :class_name => "Katello::RepositoryPackageGroup", :dependent => :destroy, :inverse_of => :package_group
    has_many :repositories, :through => :repository_package_groups, :class_name => "Katello::Repository"
    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 self.repository_association_class
      RepositoryPackageGroup
    end

    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

14 entries across 14 versions & 1 rubygems

Version Path
katello-3.13.4 app/models/katello/package_group.rb
katello-3.13.3 app/models/katello/package_group.rb
katello-3.13.2 app/models/katello/package_group.rb
katello-3.13.1 app/models/katello/package_group.rb
katello-3.13.0 app/models/katello/package_group.rb
katello-3.13.0.rc2.1 app/models/katello/package_group.rb
katello-3.13.0.rc2 app/models/katello/package_group.rb
katello-3.12.3 app/models/katello/package_group.rb
katello-3.12.2 app/models/katello/package_group.rb
katello-3.13.0.rc1 app/models/katello/package_group.rb
katello-3.12.1 app/models/katello/package_group.rb
katello-3.12.0 app/models/katello/package_group.rb
katello-3.12.0.rc2 app/models/katello/package_group.rb
katello-3.12.0.rc1 app/models/katello/package_group.rb