mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
cfc1d58847
[ecloud] fixed a test and removed connection deprecation notices
32 lines
817 B
Ruby
32 lines
817 B
Ruby
module Fog
|
|
module Rackspace
|
|
class BlockStorage
|
|
class Real
|
|
def get_volume(volume_id)
|
|
request(
|
|
:expects => [200],
|
|
:method => 'GET',
|
|
:path => "volumes/#{volume_id}"
|
|
)
|
|
end
|
|
end
|
|
|
|
class Mock
|
|
def get_volume(volume_id)
|
|
possible_states = ["available", "in-use"]
|
|
volume = self.data[:volumes][volume_id]
|
|
if volume.nil?
|
|
raise Fog::Rackspace::BlockStorage::NotFound
|
|
else
|
|
volume["status"] = possible_states[rand(possible_states.length)]
|
|
if volume.nil?
|
|
raise Fog::Rackspace::BlockStorage::NotFound
|
|
else
|
|
response(:body => {"volume" => volume})
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|