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

Revise mocking support to manage ip address collection in servers.

This commit is contained in:
Rupak Ganguly 2011-12-09 13:33:14 -05:00
parent 815a05d23d
commit 4d13bb0bd8
2 changed files with 16 additions and 2 deletions

View file

@ -20,8 +20,15 @@ module Fog
def associate_address(server_id, ip_address)
response = Excon::Response.new
response.status = 202
response
if server = self.data[:servers][server_id]
data = {"version"=>4, "addr"=>"#{ip_address}"}
server['addresses']['novanet_7'] << data
response.status = 202
response
else
raise Fog::Compute::HP::Error.new("InvalidServer.NotFound => The server '#{server_id}' does not exist.")
end
end
end

View file

@ -20,6 +20,13 @@ module Fog
def disassociate_address(server_id, ip_address)
response = Excon::Response.new
if server = self.data[:servers][server_id]
data = server['addresses']['novanet_7'].reject {|a| a['addr'] == ip_address}
self.data[:servers][server_id]['addresses']['novanet_7'] = data
else
raise Fog::Compute::HP::Error.new("InvalidServer.NotFound => The server '#{server_id}' does not exist.")
end
response.status = 202
response
end