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/get_console_output.rb
2013-10-30 19:02:18 -04:00

41 lines
1.1 KiB
Ruby

module Fog
module Compute
class HP
class Real
# 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