Sha256: ee4722c1a8dda9f050fc0c8cffbc27147d7b317884613cae2b25beab8fa40085

Contents?: true

Size: 1.07 KB

Versions: 9

Compression:

Stored size: 1.07 KB

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 = if target.transport_config['ssh-command']
                 ExecConnection.new(target)
               else
                 Connection.new(target, @transport_logger)
               end
        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'
require 'bolt/transport/ssh/exec_connection'

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bolt-2.17.0 lib/bolt/transport/ssh.rb
bolt-2.16.0 lib/bolt/transport/ssh.rb
bolt-2.15.0 lib/bolt/transport/ssh.rb
bolt-2.14.0 lib/bolt/transport/ssh.rb
bolt-2.13.0 lib/bolt/transport/ssh.rb
bolt-2.12.0 lib/bolt/transport/ssh.rb
bolt-2.11.1 lib/bolt/transport/ssh.rb
bolt-2.11.0 lib/bolt/transport/ssh.rb
bolt-2.10.0 lib/bolt/transport/ssh.rb