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
SUPPORTED_WINRM_SHELL_TYPES =
%i{powershell elevated cmd}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Transport

Returns a new instance of Transport.



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

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

Instance Method Details

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



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

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