Sha256: 19a16a0cf49df497c5b045f5f1aba52045e3d59e8e692f0208357b6524850fbe

Contents?: true

Size: 653 Bytes

Versions: 10

Compression:

Stored size: 653 Bytes

Contents

module Katello
  module Validators
    class AlternateContentSourceProductsValidator < ActiveModel::EachValidator
      def validate_each(record, attribute, value)
        if value && (attribute == :product_id)
          product = ::Katello::Product.find(value)
          content_type = record.alternate_content_source.content_type
          if product.acs_compatible_repositories.with_type(content_type).empty?
            record.errors.add(attribute, _("%{name} has no %{type} repositories with upstream URLs to add to the alternate content source.") % { name: product.name, type: content_type })
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
katello-4.14.2 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.15.0 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.15.0.rc2 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.15.0.rc1 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.14.1 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.14.0 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.14.0.rc3 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.14.0.rc2 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.14.0.rc1.1 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.14.0.rc1 app/lib/katello/validators/alternate_content_source_products_validator.rb