Sha256: 4a76b6d5ee83bf8afaf97c457ae0d29644a850976a283096718a9c5a21c5c5cf

Contents?: true

Size: 549 Bytes

Versions: 8

Compression:

Stored size: 549 Bytes

Contents

module Katello
  module Validators
    class ContainerImageNameValidator < ActiveModel::EachValidator
      def validate_each(record, attribute, value)
        if value && !ContainerImageNameValidator.validate_name(value)
          record.errors[attribute] << N_("invalid container image name")
        end
      end

      def self.validate_name(name)
        if name.empty? || name.length > 255 || !/\A([a-z0-9]+[a-z0-9\-_.]*)+(\/[a-z0-9]+[a-z0-9\-_.]*)*\z/.match?(name)
          return false
        end
        true
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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