Sha256: 30da8afe0a5b6e230eba45138abfeecc5b5f97c785cbbc7d5b14cfecfd7556de

Contents?: true

Size: 906 Bytes

Versions: 5

Compression:

Stored size: 906 Bytes

Contents

# frozen_string_literal: true

require 'bolt/node/errors'
require 'bolt/transport/simple'

module Bolt
  module Transport
    class SSH < Simple
      def initialize
        super

        require 'net/ssh'
        require 'net/scp'
        begin
          require 'net/ssh/krb'
        rescue LoadError
          logger.debug("Authentication method 'gssapi-with-mic' (Kerberos) is not available.")
        end

        @transport_logger = Logging.logger[Net::SSH]
        @transport_logger.level = :warn
      end

      def with_connection(target)
        conn = Connection.new(target, @transport_logger)
        conn.connect
        yield conn
      ensure
        begin
          conn&.disconnect
        rescue StandardError => e
          logger.info("Failed to close connection to #{target.safe_name} : #{e.message}")
        end
      end
    end
  end
end

require 'bolt/transport/ssh/connection'

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bolt-2.9.0 lib/bolt/transport/ssh.rb
bolt-2.8.0 lib/bolt/transport/ssh.rb
bolt-2.7.0 lib/bolt/transport/ssh.rb
bolt-2.6.0 lib/bolt/transport/ssh.rb
bolt-2.5.0 lib/bolt/transport/ssh.rb