Class: Container

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Authorizable, ForemanDocker::ParameterValidators, Taxonomix
Defined in:
app/models/container.rb

Instance Method Summary collapse

Methods included from ForemanDocker::ParameterValidators

#parameters_symbol

Instance Method Details

#in_fogObject



35
36
37
# File 'app/models/container.rb', line 35

def in_fog
  @fog_container ||= compute_resource.vms.get(uuid)
end

#parametrizeObject



24
25
26
27
28
29
30
31
32
33
# File 'app/models/container.rb', line 24

def parametrize
  { 'name'  => name, # key has to be lower case to be picked up by the Docker API
    'Image' => repository_pull_url,
    'Tty'          => tty,                    'Memory'       => memory,
    'Entrypoint'   => entrypoint.try(:split), 'Cmd'          => command.try(:split),
    'AttachStdout' => attach_stdout,          'AttachStdin'  => attach_stdin,
    'AttachStderr' => attach_stderr,          'CpuShares'    => cpu_shares,
    'Cpuset'       => cpu_set,
    'Env' => environment_variables.map { |env| "#{env.name}=#{env.value}" } }
end

#repository_pull_urlObject



18
19
20
21
22
# File 'app/models/container.rb', line 18

def repository_pull_url
  repo = tag.blank? ? repository_name : "#{repository_name}:#{tag}"
  repo = registry.prefixed_url(repo) if registry
  repo
end