Sha256: 475ece337e2213dbc93079f9b8264bd0b79ccc6c0ffc45b6501ebab9134a09f5

Contents?: true

Size: 678 Bytes

Versions: 15

Compression:

Stored size: 678 Bytes

Contents

module Katello
  module Validators
    class AlternateContentSourceProductsValidator < ActiveModel::EachValidator
      def validate_each(record, attribute, value)
        if value
          if attribute == :product_id
            product = ::Katello::Product.find(value)
            content_type = record.alternate_content_source.content_type
            if product.repositories.with_type(content_type).has_url.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
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
katello-4.13.1 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.13.0 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.12.1 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.13.0.rc1 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.12.0 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.12.0.rc3 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.12.0.rc2 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.12.0.rc1 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.11.1 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.11.0 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.11.0.rc2 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.11.0.rc1 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.10.0 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.10.0.rc2 app/lib/katello/validators/alternate_content_source_products_validator.rb
katello-4.10.0.rc1 app/lib/katello/validators/alternate_content_source_products_validator.rb