Class: KuberKit::ImageCompiler::BuildServerPool
- Defined in:
- lib/kuber_kit/image_compiler/build_server_pool.rb
Instance Attribute Summary collapse
-
#local_shell ⇒ Object
readonly
Returns the value of attribute local_shell.
-
#ssh_shells ⇒ Object
readonly
Returns the value of attribute ssh_shells.
Instance Method Summary collapse
- #disconnect_all ⇒ Object
- #get_shell ⇒ Object
-
#initialize(local_shell:, build_servers:, ssh_shell_class:) ⇒ BuildServerPool
constructor
A new instance of BuildServerPool.
Constructor Details
#initialize(local_shell:, build_servers:, ssh_shell_class:) ⇒ BuildServerPool
Returns a new instance of BuildServerPool.
4 5 6 7 8 9 |
# 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 |
Instance Attribute Details
#local_shell ⇒ Object (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_shells ⇒ Object (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_all ⇒ Object
21 22 23 |
# File 'lib/kuber_kit/image_compiler/build_server_pool.rb', line 21 def disconnect_all @ssh_shells.each(&:disconnect) end |
#get_shell ⇒ Object
11 12 13 14 15 16 17 18 19 |
# 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 |