Sha256: 6a5b7745f1265e5ca4f4b182acb32ecf132131dcfc5590a4ec637b1eb33c8efc

Contents?: true

Size: 1.43 KB

Versions: 70

Compression:

Stored size: 1.43 KB

Contents

class TestLab
  class Node

    module SSH

      # SSH to the Node
      def ssh(options={})
        if (!defined?(@ssh) || @ssh.nil?)
          @ssh ||= ZTK::SSH.new({:ui => @ui, :timeout => 3600, :silence => true}.merge(options))
          @ssh.config do |c|
            c.host_name = @provider.ip
            c.port      = @provider.port
            c.user      = @provider.user
            c.keys      = [@provider.identity].flatten.compact
          end
        end
        @ssh
      end

      # SSH to a container running on the Node
      def container_ssh(container, options={})
        name = container.id
        @container_ssh ||= Hash.new
        if @container_ssh[name].nil?
          @container_ssh[name] ||= ZTK::SSH.new({:ui => @ui, :timeout => 3600, :silence => true}.merge(options))
          @container_ssh[name].config do |c|
            c.proxy_host_name = @provider.ip
            c.proxy_port      = @provider.port
            c.proxy_user      = @provider.user
            c.proxy_keys      = @provider.identity

            c.host_name       = container.ip

            c.user            = (options[:user]   || container.primary_user.username)
            c.password        = (options[:passwd] || container.primary_user.password)
            c.keys            = (options[:keys]   || [container.primary_user.identity, @provider.identity].flatten.compact)
          end
        end
        @container_ssh[name]
      end

    end

  end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
testlab-1.6.6 lib/testlab/node/ssh.rb
testlab-1.6.5 lib/testlab/node/ssh.rb
testlab-1.6.4 lib/testlab/node/ssh.rb
testlab-1.6.3 lib/testlab/node/ssh.rb
testlab-1.6.2 lib/testlab/node/ssh.rb
testlab-1.6.1 lib/testlab/node/ssh.rb
testlab-1.6.0 lib/testlab/node/ssh.rb
testlab-1.5.1 lib/testlab/node/ssh.rb
testlab-1.5.0 lib/testlab/node/ssh.rb
testlab-1.4.4 lib/testlab/node/ssh.rb
testlab-1.4.3 lib/testlab/node/ssh.rb
testlab-1.4.2 lib/testlab/node/ssh.rb
testlab-1.4.1 lib/testlab/node/ssh.rb
testlab-1.4.0 lib/testlab/node/ssh.rb
testlab-1.3.2 lib/testlab/node/ssh.rb
testlab-1.3.1 lib/testlab/node/ssh.rb
testlab-1.3.0 lib/testlab/node/ssh.rb
testlab-1.2.3 lib/testlab/node/ssh.rb
testlab-1.2.2 lib/testlab/node/ssh.rb
testlab-1.2.1 lib/testlab/node/ssh.rb