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.

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.



87
88
89
90
# File 'lib/train-winrm/transport.rb', line 87

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

Instance Method Details

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



93
94
95
96
97
98
99
100
101
102
103
# File 'lib/train-winrm/transport.rb', line 93

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