1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Update mocking support.

This commit is contained in:
Rupak Ganguly 2012-04-05 13:01:47 -04:00
parent f9c289a95b
commit 68c6aeab81
5 changed files with 17 additions and 8 deletions

View file

@ -14,8 +14,15 @@ module Fog
def change_password_server(server_id, admin_password)
response = Excon::Response.new
response.status = 202
response
if list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
if admin_password
response.body = { 'changePassword' => { 'adminPass' => admin_password }}
end
response.status = 202
response
else
raise Fog::Compute::HP::NotFound
end
end
end

View file

@ -102,7 +102,7 @@ module Fog
response.status = 202
data = {
'addresses' => { "novanet_7"=>[{"version"=>4, "addr"=>Fog::HP::Mock.ip_address}] },
'addresses' => { "private"=>[{"version"=>4, "addr"=>Fog::HP::Mock.ip_address}] },
'flavor' => {"id"=>"1", "links"=>[{"href"=>"http://nova1:8774/admin/flavors/1", "rel"=>"bookmark"}]},
'id' => Fog::Mock.random_numbers(6).to_s,
'image' => {"id"=>"3", "links"=>[{"href"=>"http://nova1:8774/admin/images/3", "rel"=>"bookmark"}]},

View file

@ -20,8 +20,12 @@ module Fog
def reboot_server(server_id, type = 'SOFT')
response = Excon::Response.new
response.status = 202
response
if list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
response.status = 202
response
else
raise Fog::Compute::HP::NotFound
end
end
end

View file

@ -22,6 +22,7 @@ module Fog
def rebuild_server(server_id, image_ref, name, admin_pass=nil, metadata=nil, personality=nil)
response = get_server_details(server_id)
response.body['server']['status'] = "REBUILD"
response.status = 202
response
end

View file

@ -26,9 +26,6 @@ module Fog
def update_server(server_id, options)
response = Excon::Response.new
if server = list_servers_detail.body['servers'].detect {|_| _['id'] == server_id}
if options['adminPass']
server['adminPass'] = options['adminPass']
end
if options['name']
server['name'] = options['name']
end