1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/hp/requests/compute_v2/get_console_output.rb

41 lines
1.2 KiB
Ruby

module Fog
module Compute
class HPV2
class Real
# Retrieve console output for specified instance
#
# ==== Parameters
# * 'server_id'<~Stribng> - UUId 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::HPV2::NotFound
end
response
end
end
end
end
end