1 |
5c0db244
|
Dominic Cleal
|
require 'resolv'
|
2 |
|
|
|
3 |
bc82d5d5
|
Vanya Jauhal
|
module ForemanDocker
|
4 |
2b80fdd9
|
orrabin
|
class Dns < DockerParameter
|
5 |
bc82d5d5
|
Vanya Jauhal
|
belongs_to :container, :foreign_key => :reference_id,
|
6 |
|
|
:inverse_of => :dns,
|
7 |
|
|
:class_name => "Container"
|
8 |
|
|
|
9 |
2b80fdd9
|
orrabin
|
audited :associated_with => :container, :allow_mass_assignment => true
|
10 |
|
|
validates :key, :uniqueness => { :scope => :reference_id },
|
11 |
bc82d5d5
|
Vanya Jauhal
|
: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 |