Sha256: 4d99cb2133d74a129fc0057573affb8955ee0205c6c641173017bd626930aa58
Contents?: true
Size: 1.49 KB
Versions: 31
Compression:
Stored size: 1.49 KB
Contents
module Katello module Validators class HostgroupKickstartRepositoryValidator < ActiveModel::Validator def validate(facet) # check content source first, otherwise it's meaningless to proceed if facet.content_source && facet.lifecycle_environment valid = facet.content_source.lifecycle_environments.include?(facet.lifecycle_environment) facet.errors.add(:base, _("The selected content source and lifecycle environment do not match")) && return unless valid end return unless facet.kickstart_repository_id msg = if facet.content_source.blank? _("Please select a content source before assigning a kickstart repository") elsif facet.hostgroup.operatingsystem.blank? _("Please select an operating system before assigning a kickstart repository") elsif !facet.hostgroup.operatingsystem.is_a?(Redhat) _("Kickstart repositories can only be assigned to hosts in the Red Hat family") elsif facet.hostgroup.architecture.blank? _("Please select an architecture before assigning a kickstart repository") elsif !facet.hostgroup.matching_kickstart_repository?(facet) _("The selected kickstart repository is not part of the assigned content view, lifecycle environment, content source, operating system, and architecture") end facet.errors.add(:base, msg) if msg end end end end
Version data entries
31 entries across 31 versions & 1 rubygems