Class: Proxy::RemoteExecution::Ssh::CommandUpdate

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_proxy_remote_execution_ssh_core/command_update.rb

Overview

update sent back to the suspended action

Defined Under Namespace

Classes: Data, DebugData, StatusData, StderrData, StdoutData

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(buffer) ⇒ CommandUpdate

Returns a new instance of CommandUpdate.



8
9
10
11
# File 'lib/smart_proxy_remote_execution_ssh_core/command_update.rb', line 8

def initialize(buffer)
  @buffer = buffer
  extract_exit_status
end

Instance Attribute Details

#bufferObject (readonly)

Returns the value of attribute buffer.



6
7
8
# File 'lib/smart_proxy_remote_execution_ssh_core/command_update.rb', line 6

def buffer
  @buffer
end

#exit_statusObject (readonly)

Returns the value of attribute exit_status.



6
7
8
# File 'lib/smart_proxy_remote_execution_ssh_core/command_update.rb', line 6

def exit_status
  @exit_status
end

Class Method Details

.encode_exception(description, exception, fatal = true) ⇒ Object



26
27
28
29
30
# File 'lib/smart_proxy_remote_execution_ssh_core/command_update.rb', line 26

def self.encode_exception(description, exception, fatal = true)
  ret = [DebugData.new("#{description}\n#{exception.class} #{exception.message}")]
  ret << StatusData.new('EXCEPTION') if fatal
  return ret
end

Instance Method Details

#buffer_to_hashObject



22
23
24
# File 'lib/smart_proxy_remote_execution_ssh_core/command_update.rb', line 22

def buffer_to_hash
  buffer.map(&:to_hash)
end

#extract_exit_statusObject



13
14
15
16
17
18
19
20
# File 'lib/smart_proxy_remote_execution_ssh_core/command_update.rb', line 13

def extract_exit_status
  @buffer.delete_if do |data|
    if data.is_a? StatusData
      @exit_status = data.data
      true
    end
  end
end