Module: Performa::ContainerRegistry

Extended by:
ShellHelper
Defined in:
lib/performa/container_registry.rb

Class Method Summary collapse

Methods included from ShellHelper

run_capture_command, run_command, run_container_command, run_no_capture_command

Class Method Details

.add(container_id) ⇒ Object



11
12
13
# File 'lib/performa/container_registry.rb', line 11

def add(container_id)
  containers << container_id
end

.containersObject



26
27
28
# File 'lib/performa/container_registry.rb', line 26

def containers
  Thread.current[:performa_containers] ||= Set.new
end

.kill(container_id) ⇒ Object



21
22
23
24
# File 'lib/performa/container_registry.rb', line 21

def kill(container_id)
  run_command("docker kill #{container_id}", success_only: false)
  containers.delete(container_id)
end

.kill_allObject



15
16
17
18
19
# File 'lib/performa/container_registry.rb', line 15

def kill_all
  containers.each do |container_id|
    kill(container_id)
  end
end