From d903af45623436fc649aa66293d2fcd226d3eb19 Mon Sep 17 00:00:00 2001 From: Sergio Rubio Date: Wed, 27 Feb 2013 16:58:03 +0100 Subject: [PATCH] [openstack|volume] Added missing service declaration - Fixes regresion probably caused by eb0545b - Added minimal test to catch the issue - Fixes #1605 --- lib/fog/bin/openstack.rb | 5 +++++ lib/fog/openstack.rb | 1 + tests/openstack/volume_tests.rb | 15 +++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 tests/openstack/volume_tests.rb diff --git a/lib/fog/bin/openstack.rb b/lib/fog/bin/openstack.rb index 3f66b4c49..8780b4160 100644 --- a/lib/fog/bin/openstack.rb +++ b/lib/fog/bin/openstack.rb @@ -13,6 +13,8 @@ class OpenStack < Fog::Bin Fog::Network::OpenStack when :storage Fog::Storage::OpenStack + when :volume + Fog::Volume::OpenStack else raise ArgumentError, "Unrecognized service: #{key}" end @@ -36,6 +38,9 @@ class OpenStack < Fog::Bin when :storage Fog::Logger.warning("OpenStack[:storage] is not recommended, use Storage[:openstack] for portability") 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 raise ArgumentError, "Unrecognized service: #{key.inspect}" end diff --git a/lib/fog/openstack.rb b/lib/fog/openstack.rb index 8b7dc5488..0b7cf6128 100644 --- a/lib/fog/openstack.rb +++ b/lib/fog/openstack.rb @@ -46,6 +46,7 @@ module Fog service(:identity, 'openstack/identity', 'Identity') service(:network, 'openstack/network', 'Network') service(:storage, 'openstack/storage', 'Storage') + service(:volume, 'openstack/volume', 'Volume') # legacy v1.0 style auth def self.authenticate_v1(options, connection_options = {}) diff --git a/tests/openstack/volume_tests.rb b/tests/openstack/volume_tests.rb new file mode 100644 index 000000000..2a8b0badd --- /dev/null +++ b/tests/openstack/volume_tests.rb @@ -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 +