Project

General

Profile

Download (1006 Bytes) Statistics
| Branch: | Tag: | Revision:

foreman_docker / app / models / foreman_docker / dns.rb @ bc82d5d5

1 bc82d5d5 Vanya Jauhal
module ForemanDocker
2
  class Dns < Parameter
3
    # The Parameter class from which this Dns class inherits,validates for the
4
    # presence of an associated domain,  operating system, host or host group.
5
    # We will have to reset those validations for the Dns class as they do not
6
    # make any sense for the context in which this class is being used here.
7
    ForemanDocker::Dns.reset_callbacks(:validate)
8
9
    belongs_to :container, :foreign_key => :reference_id,
10
                           :inverse_of => :dns,
11
                           :class_name => "Container"
12
13
    audited :except => [:priority], :associated_with => :container, :allow_mass_assignment => true
14
    validates :name, :uniqueness => { :scope => :reference_id },
15
                     :format => {
16
                       :with => Regexp.union(Resolv::IPv4::Regex,
17
                                             Resolv::IPv6::Regex,
18
                                             /^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}$/) }
19
  end
20
end