Project

General

Profile

Revision 2b80fdd9

Added by Ori Rabin almost 6 years ago

Fixes #13043 - Change Parameter inheritance to DockerParameter

View differences:

app/models/foreman_docker/dns.rb
1 1
require 'resolv'
2 2

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

  
4
  class Dns < DockerParameter
11 5
    belongs_to :container, :foreign_key => :reference_id,
12 6
                           :inverse_of => :dns,
13 7
                           :class_name => "Container"
14 8

  
15
    audited :except => [:priority], :associated_with => :container, :allow_mass_assignment => true
16
    validates :name, :uniqueness => { :scope => :reference_id },
9
    audited :associated_with => :container, :allow_mass_assignment => true
10
    validates :key, :uniqueness => { :scope => :reference_id },
17 11
                     :format => {
18 12
                       :with => Regexp.union(Resolv::IPv4::Regex,
19 13
                                             Resolv::IPv6::Regex,

Also available in: Unified diff