Sha256: c69c1f1edbcfb299797ac74363bd5e153b6e1acc2b47e142d2d7d3067fe1dcf3

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

require 'resolv'

module ForemanDocker
  class Dns < Parameter
    attr_accessible :priority

    # The Parameter class from which this Dns class inherits,validates for the
    # presence of an associated domain,  operating system, host or host group.
    # We will have to reset those validations for the Dns class as they do not
    # make any sense for the context in which this class is being used here.
    ForemanDocker::Dns.reset_callbacks(:validate)

    belongs_to :container, :foreign_key => :reference_id,
                           :inverse_of => :dns,
                           :class_name => "Container"

    audited :except => [:priority], :associated_with => :container, :allow_mass_assignment => true
    validates :name, :uniqueness => { :scope => :reference_id },
                     :format => {
                       :with => Regexp.union(Resolv::IPv4::Regex,
                                             Resolv::IPv6::Regex,
                                             /^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}$/) }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_docker-2.1.1 app/models/foreman_docker/dns.rb
foreman_docker-2.1.0 app/models/foreman_docker/dns.rb
foreman_docker-2.0.1 app/models/foreman_docker/dns.rb
foreman_docker-2.0.0 app/models/foreman_docker/dns.rb