Sha256: 9f96eb04ed116e0f62dd9d7afce00a9242c143b84930ffd1396358cf6e2ad66d
Contents?: true
Size: 1.12 KB
Versions: 14
Compression:
Stored size: 1.12 KB
Contents
module Katello module Validators class HostgroupKickstartRepositoryValidator < ActiveModel::Validator def validate(facet) 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
14 entries across 14 versions & 1 rubygems