Class: KuberKit::ImageCompiler::BuildServerPool

Inherits:
Object
  • Object
show all
Defined in:
lib/kuber_kit/image_compiler/build_server_pool.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(local_shell:, build_servers:, ssh_shell_class:) ⇒ BuildServerPool

Returns a new instance of BuildServerPool.



4
5
6
7
8
# File 'lib/kuber_kit/image_compiler/build_server_pool.rb', line 4

def initialize(local_shell:, build_servers:, ssh_shell_class:)
  @local_shell     = local_shell
  @ssh_shell_class = ssh_shell_class
  @ssh_shells      = connect_to_ssh_shells(build_servers)
end

Instance Attribute Details

#local_shellObject (readonly)

Returns the value of attribute local_shell.



2
3
4
# File 'lib/kuber_kit/image_compiler/build_server_pool.rb', line 2

def local_shell
  @local_shell
end

#ssh_shellsObject (readonly)

Returns the value of attribute ssh_shells.



2
3
4
# File 'lib/kuber_kit/image_compiler/build_server_pool.rb', line 2

def ssh_shells
  @ssh_shells
end

Instance Method Details

#disconnect_allObject



18
19
20
# File 'lib/kuber_kit/image_compiler/build_server_pool.rb', line 18

def disconnect_all
  @ssh_shells.each(&:disconnect)
end

#get_shellObject



10
11
12
13
14
15
16
# File 'lib/kuber_kit/image_compiler/build_server_pool.rb', line 10

def get_shell
  if @ssh_shells.any?
    @ssh_shells.sample
  else
    @local_shell
  end
end