Sha256: 0ca5970411becd063a910bc1415a9aa41a673248e057101da176772466e1e523

Contents?: true

Size: 1.7 KB

Versions: 2

Compression:

Stored size: 1.7 KB

Contents

class DockerContainerWizardState < ActiveRecord::Base
  has_one :preliminary, :class_name => DockerContainerWizardStates::Preliminary,
                        :dependent => :destroy, :validate => true, :autosave => true
  has_one :image, :class_name => DockerContainerWizardStates::Image,
                  :dependent => :destroy, :validate => true, :autosave => true
  has_one :configuration, :class_name => DockerContainerWizardStates::Configuration,
                          :dependent => :destroy, :validate => true, :autosave => true
  has_one :environment, :class_name => DockerContainerWizardStates::Environment,
                        :dependent => :destroy, :validate => true, :autosave => true

  delegate :compute_resource_id,   :to => :preliminary
  delegate :compute_resource, :to => :preliminary

  delegate :environment_variables, :to => :environment
  delegate :exposed_ports, :to => :environment
  delegate :dns, :to => :environment

  def container_attributes
    { :repository_name     => image.repository_name,
      :tag                 => image.tag,
      :registry_id         => image.registry_id,
      :name                => configuration.name,
      :compute_resource_id => preliminary.compute_resource_id,
      :tty                 => environment.tty,
      :memory              => configuration.memory,
      :entrypoint          => configuration.entrypoint,
      :command             => configuration.command,
      :attach_stdout       => environment.attach_stdout,
      :attach_stdin        => environment.attach_stdin,
      :attach_stderr       => environment.attach_stderr,
      :cpu_shares          => configuration.cpu_shares,
      :cpu_set             => configuration.cpu_set
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreman_docker-3.2.1 app/models/docker_container_wizard_state.rb
foreman_docker-3.1.0 app/models/docker_container_wizard_state.rb