Class: WINRM
- Inherits:
-
Object
- Object
- WINRM
- Defined in:
- lib/winrm_connection.rb
Instance Attribute Summary collapse
-
#server ⇒ Object
(also: #xserver)
readonly
Returns the value of attribute server.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #exec(cmd) ⇒ Object
-
#initialize(server, opts) ⇒ WINRM
constructor
A new instance of WINRM.
- #on_close ⇒ Object
- #on_data ⇒ Object
- #on_extended_data ⇒ Object
- #on_request(req_type) ⇒ Object
- #open_channel {|_self| ... } ⇒ Object
- #process_data ⇒ Object
Constructor Details
#initialize(server, opts) ⇒ WINRM
Returns a new instance of WINRM.
8 9 10 11 12 |
# File 'lib/winrm_connection.rb', line 8 def initialize(server, opts) @server = server @int_hash = {:options => opts, :server => server} @winrm = establish_winrm(opts) end |
Instance Attribute Details
#server ⇒ Object (readonly) Also known as: xserver
Returns the value of attribute server.
5 6 7 |
# File 'lib/winrm_connection.rb', line 5 def server @server end |
Instance Method Details
#[](key) ⇒ Object
14 15 16 |
# File 'lib/winrm_connection.rb', line 14 def [](key) @int_hash[key.to_sym] end |
#[]=(key, value) ⇒ Object
18 19 20 |
# File 'lib/winrm_connection.rb', line 18 def []=(key, value) @int_hash[key.to_sym] = value end |
#exec(cmd) ⇒ Object
26 27 28 |
# File 'lib/winrm_connection.rb', line 26 def exec(cmd) @ios = @winrm.cmd(cmd) end |
#on_close ⇒ Object
42 |
# File 'lib/winrm_connection.rb', line 42 def on_close; self; end |
#on_data ⇒ Object
39 |
# File 'lib/winrm_connection.rb', line 39 def on_data; self; end |
#on_extended_data ⇒ Object
40 |
# File 'lib/winrm_connection.rb', line 40 def on_extended_data; self; end |
#on_request(req_type) ⇒ Object
41 |
# File 'lib/winrm_connection.rb', line 41 def on_request(req_type); self; end |
#open_channel {|_self| ... } ⇒ Object
22 23 24 |
# File 'lib/winrm_connection.rb', line 22 def open_channel yield self end |
#process_data ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/winrm_connection.rb', line 30 def process_data @ios[:data].each do |ds| key = ds.keys.first stream = (key == :stdout) ? :out : :err yield self, stream, ds[key] end self[:status] = @ios[:exitcode] end |