mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
43 lines
1.2 KiB
Ruby
43 lines
1.2 KiB
Ruby
module Fog
|
|
module Compute
|
|
class HP
|
|
class Real
|
|
|
|
require 'fog/aws/parsers/compute/get_console_output'
|
|
|
|
# Retrieve console output for specified instance
|
|
#
|
|
# ==== Parameters
|
|
# * server_id<~Integer> - Id of instance to get console output from
|
|
# * num_lines<~Integer> - Number of lines of console output from the end
|
|
# ==== Returns
|
|
# # * response<~Excon::Response>:
|
|
# * body<~Hash>:
|
|
# * 'output'<~String> - Console output
|
|
#
|
|
def get_console_output(server_id, num_lines)
|
|
body = { 'os-getConsoleOutput' => { 'length' => num_lines }}
|
|
server_action(server_id, body, 200)
|
|
end
|
|
|
|
end
|
|
|
|
class Mock
|
|
|
|
def get_console_output(server_id, num_lines)
|
|
output = ""
|
|
response = Excon::Response.new
|
|
if list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
|
|
(1..num_lines).each {|i| output += "Console Output Line #{i} \r\n"}
|
|
response.body = { 'output' => output }
|
|
response.status = 200
|
|
else
|
|
raise Fog::Compute::HP::NotFound
|
|
end
|
|
response
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|
|
end
|