class WinRM::WSMV::CleanupCommand

WSMV message to execute a command inside a remote shell

Public Class Methods

new(session_opts, opts) click to toggle source
# File lib/winrm/wsmv/cleanup_command.rb, line 21
def initialize(session_opts, opts)
  raise 'opts[:shell_id] is required' unless opts[:shell_id]
  raise 'opts[:command_id] is required' unless opts[:command_id]

  @session_opts = session_opts
  @shell_id = opts[:shell_id]
  @command_id = opts[:command_id]
  @shell_uri = opts[:shell_uri] || RESOURCE_URI_CMD
end

Protected Instance Methods

create_body(body) click to toggle source
# File lib/winrm/wsmv/cleanup_command.rb, line 37
def create_body(body)
  body.tag!("#{NS_WIN_SHELL}:Signal", 'CommandId' => @command_id) do |cl|
    cl << Gyoku.xml(cleanup_body)
  end
end
create_header(header) click to toggle source
# File lib/winrm/wsmv/cleanup_command.rb, line 33
def create_header(header)
  header << Gyoku.xml(cleanup_header)
end

Private Instance Methods

cleanup_body() click to toggle source
# File lib/winrm/wsmv/cleanup_command.rb, line 52
def cleanup_body
  {
    "#{NS_WIN_SHELL}:Code" =>
      'http://schemas.microsoft.com/wbem/wsman/1/windows/shell/signal/terminate'
  }
end
cleanup_header() click to toggle source
# File lib/winrm/wsmv/cleanup_command.rb, line 45
def cleanup_header
  merge_headers(shared_headers(@session_opts),
                resource_uri_shell(@shell_uri),
                action_signal,
                selector_shell_id(@shell_id))
end