mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
d37397becc
bugfix in voxcloud_delete mock, devices vs servers
32 lines
762 B
Ruby
32 lines
762 B
Ruby
module Fog
|
|
module Voxel
|
|
class Compute
|
|
class Real
|
|
def voxcloud_delete( device_id )
|
|
options = { :device_id => device_id }
|
|
data = request("voxel.voxcloud.delete", options )
|
|
|
|
unless data['stat'] == 'ok'
|
|
raise "Error from Voxel hAPI: #{data['err']['msg']}"
|
|
end
|
|
|
|
true
|
|
end
|
|
end
|
|
|
|
class Mock
|
|
def voxcloud_delete( device_id )
|
|
device = @data[:servers].select { |d| d[:id] == device_id }
|
|
|
|
if device.empty?
|
|
raise Fog::Voxel::Compute::NotFound
|
|
else
|
|
@data[:servers] = @data[:servers].select { |d| d[:id] != device_id }
|
|
@data[:statuses].delete(device_id)
|
|
true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|