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

[openstack|volume] Added missing service declaration

- Fixes regresion probably caused by eb0545b
- Added minimal test to catch the issue
- Fixes #1605
This commit is contained in:
Sergio Rubio 2013-02-27 16:58:03 +01:00
parent 3aaa584a88
commit d903af4562
3 changed files with 21 additions and 0 deletions

View file

@ -13,6 +13,8 @@ class OpenStack < Fog::Bin
Fog::Network::OpenStack Fog::Network::OpenStack
when :storage when :storage
Fog::Storage::OpenStack Fog::Storage::OpenStack
when :volume
Fog::Volume::OpenStack
else else
raise ArgumentError, "Unrecognized service: #{key}" raise ArgumentError, "Unrecognized service: #{key}"
end end
@ -36,6 +38,9 @@ class OpenStack < Fog::Bin
when :storage when :storage
Fog::Logger.warning("OpenStack[:storage] is not recommended, use Storage[:openstack] for portability") Fog::Logger.warning("OpenStack[:storage] is not recommended, use Storage[:openstack] for portability")
Fog::Storage.new(:provider => 'OpenStack') Fog::Storage.new(:provider => 'OpenStack')
when :volume
Fog::Logger.warning("OpenStack[:volume] is not recommended, use Volume[:openstack] for portability")
Fog::Volume.new(:provider => 'OpenStack')
else else
raise ArgumentError, "Unrecognized service: #{key.inspect}" raise ArgumentError, "Unrecognized service: #{key.inspect}"
end end

View file

@ -46,6 +46,7 @@ module Fog
service(:identity, 'openstack/identity', 'Identity') service(:identity, 'openstack/identity', 'Identity')
service(:network, 'openstack/network', 'Network') service(:network, 'openstack/network', 'Network')
service(:storage, 'openstack/storage', 'Storage') service(:storage, 'openstack/storage', 'Storage')
service(:volume, 'openstack/volume', 'Volume')
# legacy v1.0 style auth # legacy v1.0 style auth
def self.authenticate_v1(options, connection_options = {}) def self.authenticate_v1(options, connection_options = {})

View file

@ -0,0 +1,15 @@
Shindo.tests('Fog::Volume[:openstack]', ['openstack', 'volume']) do
volume = Fog::Volume[:openstack]
tests("Volumes collection") do
%w{ volumes }.each do |collection|
test("it should respond to #{collection}") { volume.respond_to? collection }
test("it should respond to #{collection}.all") { eval("volume.#{collection}").respond_to? 'all' }
# not implemented
#test("it should respond to #{collection}.get") { eval("volume.#{collection}").respond_to? 'get' }
end
end
end