class KuberKit::ImageCompiler::BuildServerPool
Attributes
local_shell[R]
ssh_shells[R]
Public Class Methods
new(local_shell:, build_servers:, ssh_shell_class:)
click to toggle source
# 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 @build_servers = build_servers @ssh_shells = [] end
Public Instance Methods
disconnect_all()
click to toggle source
# File lib/kuber_kit/image_compiler/build_server_pool.rb, line 21 def disconnect_all @ssh_shells.each(&:disconnect) end
get_shell()
click to toggle source
# File lib/kuber_kit/image_compiler/build_server_pool.rb, line 11 def get_shell if @build_servers.any? shell = connect_to_ssh_shell(@build_servers.sample) @ssh_shells << shell shell else @local_shell end end
Private Instance Methods
connect_to_ssh_shell(bs)
click to toggle source
# File lib/kuber_kit/image_compiler/build_server_pool.rb, line 26 def connect_to_ssh_shell(bs) shell = @ssh_shell_class.new shell.connect(host: bs.host, user: bs.user, port: bs.port) shell end