Sha256: d683cc7cec98ec8b93eacd56c0a9af1d2e474a7f275a8c46e8ad815377548bfc

Contents?: true

Size: 711 Bytes

Versions: 92

Compression:

Stored size: 711 Bytes

Contents

class KuberKit::ImageCompiler::BuildServerPool
  attr_reader :ssh_shells, :local_shell
  
  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

  def get_shell
    if @build_servers.any?
      shell = connect_to_ssh_shell(@build_servers.sample)
      @ssh_shells << shell
      shell
    else
      @local_shell
    end
  end

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

  private
    def connect_to_ssh_shell(bs)
      shell = @ssh_shell_class.new
      shell.connect(host: bs.host, user: bs.user, port: bs.port)
      shell
    end
end

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
kuber_kit-1.3.8 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.3.7 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.1.8 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.3.6 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.1.7 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.3.5 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.3.4 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.1.6 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.3.3 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.3.2 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.1.5 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.3.1 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.3.0 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.1.4 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.2.7 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.2.6 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.2.5 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.2.4 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.2.2 lib/kuber_kit/image_compiler/build_server_pool.rb
kuber_kit-1.1.2 lib/kuber_kit/image_compiler/build_server_pool.rb