Project

General

Profile

Download (1.65 KB) Statistics
| Branch: | Tag: | Revision:

foreman_docker / app / models / docker_container_wizard_state.rb @ bc82d5d5

1 6d101d7a Dmitri Dolguikh
class DockerContainerWizardState < ActiveRecord::Base
2
  has_one :preliminary, :class_name => DockerContainerWizardStates::Preliminary,
3 ac230210 David Davis
                        :dependent => :destroy, :validate => true, :autosave => true
4 6d101d7a Dmitri Dolguikh
  has_one :image, :class_name => DockerContainerWizardStates::Image,
5 ac230210 David Davis
                  :dependent => :destroy, :validate => true, :autosave => true
6 6d101d7a Dmitri Dolguikh
  has_one :configuration, :class_name => DockerContainerWizardStates::Configuration,
7 ac230210 David Davis
                          :dependent => :destroy, :validate => true, :autosave => true
8 6d101d7a Dmitri Dolguikh
  has_one :environment, :class_name => DockerContainerWizardStates::Environment,
9 ac230210 David Davis
                        :dependent => :destroy, :validate => true, :autosave => true
10 6d101d7a Dmitri Dolguikh
11 e4e8739b Daniel Lobato
  delegate :compute_resource_id,   :to => :preliminary
12 6d101d7a Dmitri Dolguikh
  delegate :environment_variables, :to => :environment
13 8e2848d5 Vanya Jauhal
  delegate :exposed_ports, :to => :environment
14 bc82d5d5 Vanya Jauhal
  delegate :dns, :to => :environment
15 6d101d7a Dmitri Dolguikh
16
  def container_attributes
17 e4e8739b Daniel Lobato
    { :repository_name     => image.repository_name,
18
      :tag                 => image.tag,
19
      :registry_id         => image.registry_id,
20
      :name                => configuration.name,
21 6d101d7a Dmitri Dolguikh
      :compute_resource_id => preliminary.compute_resource_id,
22 e4e8739b Daniel Lobato
      :tty                 => environment.tty,
23
      :memory              => configuration.memory,
24
      :entrypoint          => configuration.entrypoint,
25
      :command             => configuration.command,
26
      :attach_stdout       => environment.attach_stdout,
27
      :attach_stdin        => environment.attach_stdin,
28
      :attach_stderr       => environment.attach_stderr,
29
      :cpu_shares          => configuration.cpu_shares,
30 41572b90 Partha Aji
      :cpu_set             => configuration.cpu_set
31
    }
32 6d101d7a Dmitri Dolguikh
  end
33
end