Project

General

Profile

Revision 2b80fdd9

Added by Ori Rabin almost 6 years ago

Fixes #13043 - Change Parameter inheritance to DockerParameter

View differences:

app/models/container.rb
6 6
  belongs_to :registry, :class_name => "DockerRegistry", :foreign_key => :registry_id
7 7
  has_many :environment_variables, :dependent  => :destroy, :foreign_key => :reference_id,
8 8
                                   :inverse_of => :container,
9
                                   :class_name => 'EnvironmentVariable',
10
                                   :validate => false
9
                                   :class_name => 'EnvironmentVariable'
10

  
11 11
  accepts_nested_attributes_for :environment_variables, :allow_destroy => true
12
  include ForemanDocker::ParameterValidators
13 12

  
14 13
  has_many :exposed_ports,  :dependent  => :destroy, :foreign_key => :reference_id,
15 14
                            :inverse_of => :container,
16
                            :class_name => 'ExposedPort',
17
                            :validate => true
15
                            :class_name => 'ExposedPort'
18 16

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

  
21
  include ForemanDocker::ParameterValidators
23 22

  
24 23
  accepts_nested_attributes_for :exposed_ports, :allow_destroy => true
25 24
  scoped_search :on => :name
......
41 40
      'AttachStdout' => attach_stdout,          'AttachStdin'  => attach_stdin,
42 41
      'AttachStderr' => attach_stderr,          'CpuShares'    => cpu_shares,
43 42
      'Cpuset'       => cpu_set,
44
      'Env' => environment_variables.map { |env| "#{env.name}=#{env.value}" },
45
      'ExposedPorts' => Hash[*exposed_ports.map { |v| [v.name + "/" + v.value, {}] }.flatten],
43
      'Env' => environment_variables.map { |env| "#{env.key}=#{env.value}" },
44
      'ExposedPorts' => Hash[*exposed_ports.map { |v| [v.key + "/" + v.value, {}] }.flatten],
46 45
      'HostConfig' => {
47
        'Dns' => dns.map { |env| "#{env.name}" }
46
        'Dns' => dns.map { |env| "#{env.key}" }
48 47
      } }
49 48
  end
50 49

  

Also available in: Unified diff