Project

General

Profile

Revision bc82d5d5

Added by Vanya Jauhal almost 8 years ago

Fixes #7865 - Adds support for configuring dns during container creation

View differences:

app/models/container.rb
16 16
                            :class_name => 'ExposedPort',
17 17
                            :validate => true
18 18

  
19
  has_many :dns,  :dependent  => :destroy, :foreign_key => :reference_id,
20
                  :inverse_of => :container,
21
                  :class_name => 'ForemanDocker::Dns',
22
                  :validate => true
23

  
19 24
  accepts_nested_attributes_for :exposed_ports, :allow_destroy => true
20 25
  scoped_search :on => :name
21 26

  
22 27
  attr_accessible :command, :repository_name, :name, :compute_resource_id, :entrypoint,
23 28
                  :cpu_set, :cpu_shares, :memory, :tty, :attach_stdin, :registry_id,
24 29
                  :attach_stdout, :attach_stderr, :tag, :uuid, :environment_variables_attributes,
25
                  :katello, :exposed_ports_attributes
30
                  :katello, :exposed_ports_attributes, :dns
26 31

  
27 32
  def repository_pull_url
28 33
    repo = tag.blank? ? repository_name : "#{repository_name}:#{tag}"
......
39 44
      'AttachStderr' => attach_stderr,          'CpuShares'    => cpu_shares,
40 45
      'Cpuset'       => cpu_set,
41 46
      'Env' => environment_variables.map { |env| "#{env.name}=#{env.value}" },
42
      'ExposedPorts' => Hash[*exposed_ports.map { |v| [v.name + "/" + v.value, {}] }.flatten]
43
    }
47
      'ExposedPorts' => Hash[*exposed_ports.map { |v| [v.name + "/" + v.value, {}] }.flatten],
48
      'HostConfig' => {
49
        'Dns' => dns.map { |env| "#{env.name}" }
50
      } }
44 51
  end
45 52

  
46 53
  def in_fog

Also available in: Unified diff