Sha256: 09be1e59754d267b1e3202a9713736529456880bd35f771748814deb089d766a

Contents?: true

Size: 1.7 KB

Versions: 2

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

2 entries across 2 versions & 1 rubygems

Version Path
foreman_docker-4.0.0 app/models/docker_container_wizard_state.rb
foreman_docker-3.2.0 app/models/docker_container_wizard_state.rb