Sha256: 60fd9131bd62447403117cf46a5034ef0ddaed1b6f8f1258870dfdbbcac52a95

Contents?: true

Size: 1.7 KB

Versions: 3

Compression:

Stored size: 1.7 KB

Contents

class DockerContainerWizardState < ApplicationRecord
  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

3 entries across 3 versions & 1 rubygems

Version Path
foreman_docker-5.0.0 app/models/docker_container_wizard_state.rb
foreman_docker-4.1.1 app/models/docker_container_wizard_state.rb
foreman_docker-4.1.0 app/models/docker_container_wizard_state.rb