Project

General

Profile

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

foreman-docker / app / models / foreman_docker / dns.rb @ 2b80fdd9

1
require 'resolv'
2

    
3
module ForemanDocker
4
  class Dns < DockerParameter
5
    belongs_to :container, :foreign_key => :reference_id,
6
                           :inverse_of => :dns,
7
                           :class_name => "Container"
8

    
9
    audited :associated_with => :container, :allow_mass_assignment => true
10
    validates :key, :uniqueness => { :scope => :reference_id },
11
                     :format => {
12
                       :with => Regexp.union(Resolv::IPv4::Regex,
13
                                             Resolv::IPv6::Regex,
14
                                             /^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}$/) }
15
  end
16
end