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:
parent
815a05d23d
commit
4d13bb0bd8
2 changed files with 16 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue