Sha256: f7c798c5f40e3a5dbe23c0b339cc35cd07bc26fbaca5354f22900c01064177a0
Contents?: true
Size: 1.6 KB
Versions: 14
Compression:
Stored size: 1.6 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" scoped_search :on => :name, :complete_value => true scoped_search :on => :uuid, :rename => :id, :complete_value => true scoped_search :relation => :repositories, :on => :name, :rename => :repository, :complete_value => true def self.repository_association_class RepositoryPackageGroup end def repository self.repositories.first end def update_from_json(json) self.update_attributes!(json.slice('name', 'description')) 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.uuid) 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