Class: TrainPlugins::WinRM::Transport

Inherits:
Object
  • Object
show all
Defined in:
lib/train-winrm/transport.rb

Overview

A Transport which uses WinRM to execute commands and transfer files.

Author:

Constant Summary collapse

SUPPORTED_WINRM_TRANSPORTS =
%i{negotiate ssl plaintext kerberos}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Transport

Returns a new instance of Transport.


80
81
82
83
# File 'lib/train-winrm/transport.rb', line 80

def initialize(opts)
  super(opts)
  load_needed_dependencies!
end

Instance Method Details

#connection(state = nil, &block) ⇒ Object


86
87
88
89
90
91
92
93
94
95
96
# File 'lib/train-winrm/transport.rb', line 86

def connection(state = nil, &block)
  opts = merge_options(options, state || {})
  validate_options(opts)
  conn_opts = connection_options(opts)

  if @connection && @connection_options == conn_opts
    reuse_connection(&block)
  else
    create_new_connection(conn_opts, &block)
  end
end