Class: Container
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Container
- Includes:
- Authorizable, ForemanDocker::ParameterValidators, Taxonomix
- Defined in:
- app/models/container.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from ForemanDocker::ParameterValidators
#duplicate_key?, #validate_unique_parameter_keys
Class Method Details
.humanize_class_name(_name = nil) ⇒ Object
54 55 56 |
# File 'app/models/container.rb', line 54 def self.humanize_class_name(_name = nil) _("Docker/Container") end |
Instance Method Details
#in_fog ⇒ Object
50 51 52 |
# File 'app/models/container.rb', line 50 def in_fog @fog_container ||= compute_resource.vms.get(uuid) end |
#parametrize ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/models/container.rb', line 34 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' => ::ForemanDocker::Utility.parse_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.key}=#{env.value}" }, 'ExposedPorts' => Hash[*exposed_ports.map { |v| [v.key + "/" + v.value, {}] }.flatten], 'HostConfig' => { 'Dns' => dns.map { |env| "#{env.key}" } } } end |
#repository_pull_url ⇒ Object
28 29 30 31 32 |
# File 'app/models/container.rb', line 28 def repository_pull_url repo = tag.blank? ? repository_name : "#{repository_name}:#{tag}" repo = registry.prefixed_url(repo) if registry repo end |