foreman-docker / app / models / foreman_docker / dns.rb @ c69bcf98
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
|