Class: EventMachine::WinRM::Server
- Inherits:
-
Object
- Object
- EventMachine::WinRM::Server
- Includes:
- EM::Deferrable
- Defined in:
- lib/em-winrm/server.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#master ⇒ Object
Returns the value of attribute master.
Instance Method Summary collapse
-
#initialize(master, host, options) ⇒ Server
constructor
A new instance of Server.
-
#run_command(data) ⇒ Object
create a shell and run command.
-
#unbind ⇒ Object
Notify upstream master that the backend server is done processing the request.
Constructor Details
#initialize(master, host, options) ⇒ Server
Returns a new instance of Server.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/em-winrm/server.rb', line 28 def initialize(master, host, ) @master = master @host = host @transport = [:transport] || :plaintext @options = @options[:user] = @options.delete(:user) || ENV['USER'] || ENV['USERNAME'] || "unknown" @options[:pass] = @options.delete(:password) @options[:port] = @options.delete(:port) || 5985 @options[:basic_auth_only] = true unless defined? @options[:basic_auth_only] end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
26 27 28 |
# File 'lib/em-winrm/server.rb', line 26 def host @host end |
#master ⇒ Object
Returns the value of attribute master.
26 27 28 |
# File 'lib/em-winrm/server.rb', line 26 def master @master end |
Instance Method Details
#run_command(data) ⇒ Object
create a shell and run command
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/em-winrm/server.rb', line 42 def run_command(data) cid = UUIDTools::UUID.random_create.to_s EM.epoll EM.run do EM.defer(proc do WinRM::Log.debug("#{@host} => :run_command") @shell = Shell.new(client, self) @shell.on_output do |out| @master.relay_output_from_backend(@host, out) end @shell.on_error do |error| @master.relay_error_from_backend(@host, error) end @shell.on_close do |result, exit_code| @master.command_complete(@host, cid, exit_code) end @shell.run_command(data) end) end cid end |