diff --git a/lib/fog/bin/hp.rb b/lib/fog/bin/hp.rb index 804f444b5..9708801dc 100644 --- a/lib/fog/bin/hp.rb +++ b/lib/fog/bin/hp.rb @@ -3,14 +3,14 @@ class HP < Fog::Bin def class_for(key) case key + when :block_storage + Fog::HP::BlockStorage when :cdn Fog::CDN::HP when :compute Fog::Compute::HP when :storage Fog::Storage::HP - when :block_storage - Fog::BlockStorage::HP else # @todo Replace most instances of ArgumentError with NotImplementedError # @todo For a list of widely supported Exceptions, see: @@ -22,6 +22,8 @@ class HP < Fog::Bin def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key + when :block_storage + Fog::HP::BlockStorage.new when :cdn Fog::Logger.warning("HP[:cdn] is deprecated, use CDN[:hp] instead") Fog::CDN.new(:provider => 'HP') @@ -31,9 +33,6 @@ class HP < Fog::Bin when :storage Fog::Logger.warning("HP[:storage] is deprecated, use Storage[:hp] instead") Fog::Storage.new(:provider => 'HP') - when :block_storage - Fog::Logger.warning("HP[:block_storage] is deprecated, use BlockStorage[:hp] instead") - Fog::BlockStorage.new(:provider => 'HP') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end diff --git a/lib/fog/block_storage.rb b/lib/fog/block_storage.rb deleted file mode 100644 index cc7c8c1a9..000000000 --- a/lib/fog/block_storage.rb +++ /dev/null @@ -1,24 +0,0 @@ -module Fog - module BlockStorage - - def self.[](provider) - self.new(:provider => provider) - end - - def self.new(attributes) - attributes = attributes.dup # Prevent delete from having side effects - case provider = attributes.delete(:provider).to_s.downcase.to_sym - when :hp - require 'fog/hp/block_storage' - Fog::BlockStorage::HP.new(attributes) - else - raise ArgumentError.new("#{provider} is not a recognized block storage provider") - end - end - - def self.providers - Fog.services[:block_storage] - end - - end -end diff --git a/lib/fog/hp/block_storage.rb b/lib/fog/hp/block_storage.rb index 8b089177c..f870354da 100644 --- a/lib/fog/hp/block_storage.rb +++ b/lib/fog/hp/block_storage.rb @@ -1,9 +1,8 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'hp')) -require 'fog/block_storage' module Fog - module BlockStorage - class HP < Fog::Service + module HP + class BlockStorage < Fog::Service requires :hp_secret_key, :hp_account_id, :hp_tenant_id, :hp_avl_zone recognizes :hp_auth_uri, :persistent, :connection_options, :hp_use_upass_auth_style, :hp_auth_version, :user_agent @@ -133,7 +132,7 @@ module Fog rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound - Fog::BlockStorage::HP::NotFound.slurp(error) + Fog::HP::BlockStorage::NotFound.slurp(error) else error end diff --git a/lib/fog/hp/models/block_storage/bootable_volumes.rb b/lib/fog/hp/models/block_storage/bootable_volumes.rb index 3e9a7e770..cd0d16768 100644 --- a/lib/fog/hp/models/block_storage/bootable_volumes.rb +++ b/lib/fog/hp/models/block_storage/bootable_volumes.rb @@ -2,12 +2,12 @@ require 'fog/core/collection' require 'fog/hp/models/block_storage/volume' module Fog - module BlockStorage - class HP + module HP + class BlockStorage class BootableVolumes < Fog::Collection - model Fog::BlockStorage::HP::Volume + model Fog::HP::BlockStorage::Volume def all data = connection.list_bootable_volumes.body['volumes'] @@ -17,7 +17,7 @@ module Fog def get(volume_id) volume = connection.get_bootable_volume_details(volume_id).body['volume'] new(volume) - rescue Fog::BlockStorage::HP::NotFound + rescue Fog::HP::BlockStorage::NotFound nil end diff --git a/lib/fog/hp/models/block_storage/snapshot.rb b/lib/fog/hp/models/block_storage/snapshot.rb index f421895d6..e8795681c 100644 --- a/lib/fog/hp/models/block_storage/snapshot.rb +++ b/lib/fog/hp/models/block_storage/snapshot.rb @@ -1,8 +1,8 @@ require 'fog/core/model' module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Snapshot < Fog::Model diff --git a/lib/fog/hp/models/block_storage/snapshots.rb b/lib/fog/hp/models/block_storage/snapshots.rb index 64b81b0dc..c9a2aee43 100644 --- a/lib/fog/hp/models/block_storage/snapshots.rb +++ b/lib/fog/hp/models/block_storage/snapshots.rb @@ -2,12 +2,12 @@ require 'fog/core/collection' require 'fog/hp/models/block_storage/snapshot' module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Snapshots < Fog::Collection - model Fog::BlockStorage::HP::Snapshot + model Fog::HP::BlockStorage::Snapshot def all data = connection.list_snapshots.body['snapshots'] @@ -18,7 +18,7 @@ module Fog if snapshot = connection.get_snapshot_details(snapshot_id).body['snapshot'] new(snapshot) end - rescue Fog::BlockStorage::HP::NotFound + rescue Fog::HP::BlockStorage::NotFound nil end diff --git a/lib/fog/hp/models/block_storage/volume.rb b/lib/fog/hp/models/block_storage/volume.rb index 07b7d2c26..142c75b31 100644 --- a/lib/fog/hp/models/block_storage/volume.rb +++ b/lib/fog/hp/models/block_storage/volume.rb @@ -1,8 +1,8 @@ require 'fog/core/model' module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Volume < Fog::Model diff --git a/lib/fog/hp/models/block_storage/volumes.rb b/lib/fog/hp/models/block_storage/volumes.rb index 26685e031..ed378f247 100644 --- a/lib/fog/hp/models/block_storage/volumes.rb +++ b/lib/fog/hp/models/block_storage/volumes.rb @@ -2,12 +2,12 @@ require 'fog/core/collection' require 'fog/hp/models/block_storage/volume' module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Volumes < Fog::Collection - model Fog::BlockStorage::HP::Volume + model Fog::HP::BlockStorage::Volume def all data = connection.list_volumes.body['volumes'] @@ -17,7 +17,7 @@ module Fog def get(volume_id) volume = connection.get_volume_details(volume_id).body['volume'] new(volume) - rescue Fog::BlockStorage::HP::NotFound + rescue Fog::HP::BlockStorage::NotFound nil end diff --git a/lib/fog/hp/requests/block_storage/create_snapshot.rb b/lib/fog/hp/requests/block_storage/create_snapshot.rb index 54772d312..428d32ce0 100644 --- a/lib/fog/hp/requests/block_storage/create_snapshot.rb +++ b/lib/fog/hp/requests/block_storage/create_snapshot.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # Create a new block storage snapshot @@ -65,7 +65,7 @@ module Fog self.data[:snapshots][data['id']] = data response.body = { 'snapshot' => data } else - raise Fog::BlockStorage::HP::NotFound + raise Fog::HP::BlockStorage::NotFound end response end diff --git a/lib/fog/hp/requests/block_storage/create_volume.rb b/lib/fog/hp/requests/block_storage/create_volume.rb index 00d2a4217..b1a370e13 100644 --- a/lib/fog/hp/requests/block_storage/create_volume.rb +++ b/lib/fog/hp/requests/block_storage/create_volume.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # Create a new block storage volume diff --git a/lib/fog/hp/requests/block_storage/delete_snapshot.rb b/lib/fog/hp/requests/block_storage/delete_snapshot.rb index 84eed9c82..3ff2c3b84 100644 --- a/lib/fog/hp/requests/block_storage/delete_snapshot.rb +++ b/lib/fog/hp/requests/block_storage/delete_snapshot.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # Delete an existing block storage snapshot @@ -27,7 +27,7 @@ module Fog self.data[:snapshots].delete(snapshot_id) response.status = 202 else - raise Fog::BlockStorage::HP::NotFound + raise Fog::HP::BlockStorage::NotFound end response end diff --git a/lib/fog/hp/requests/block_storage/delete_volume.rb b/lib/fog/hp/requests/block_storage/delete_volume.rb index 4be3e6d23..cfc6d1476 100644 --- a/lib/fog/hp/requests/block_storage/delete_volume.rb +++ b/lib/fog/hp/requests/block_storage/delete_volume.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # Delete an existing block storage volume @@ -27,7 +27,7 @@ module Fog self.data[:volumes].delete(volume_id) response.status = 202 else - raise Fog::BlockStorage::HP::NotFound + raise Fog::HP::BlockStorage::NotFound end response end diff --git a/lib/fog/hp/requests/block_storage/get_bootable_volume_details.rb b/lib/fog/hp/requests/block_storage/get_bootable_volume_details.rb index 86ae19ce1..42271c0f9 100644 --- a/lib/fog/hp/requests/block_storage/get_bootable_volume_details.rb +++ b/lib/fog/hp/requests/block_storage/get_bootable_volume_details.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # Get details for existing block storage bootable volume @@ -48,7 +48,7 @@ module Fog response.body = { 'volume' => volume } response else - raise Fog::BlockStorage::HP::NotFound + raise Fog::HP::BlockStorage::NotFound end end diff --git a/lib/fog/hp/requests/block_storage/get_snapshot_details.rb b/lib/fog/hp/requests/block_storage/get_snapshot_details.rb index 647a88767..3bd236792 100644 --- a/lib/fog/hp/requests/block_storage/get_snapshot_details.rb +++ b/lib/fog/hp/requests/block_storage/get_snapshot_details.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # Get details for existing block storage snapshot @@ -43,7 +43,7 @@ module Fog response.body = { 'snapshot' => snapshot } response else - raise Fog::BlockStorage::HP::NotFound + raise Fog::HP::BlockStorage::NotFound end end diff --git a/lib/fog/hp/requests/block_storage/get_volume_details.rb b/lib/fog/hp/requests/block_storage/get_volume_details.rb index 219eb688f..9049642e1 100644 --- a/lib/fog/hp/requests/block_storage/get_volume_details.rb +++ b/lib/fog/hp/requests/block_storage/get_volume_details.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # Get details for existing block storage volume @@ -47,7 +47,7 @@ module Fog response.body = { 'volume' => volume } response else - raise Fog::BlockStorage::HP::NotFound + raise Fog::HP::BlockStorage::NotFound end end diff --git a/lib/fog/hp/requests/block_storage/list_bootable_volumes.rb b/lib/fog/hp/requests/block_storage/list_bootable_volumes.rb index ab21a10bb..699209880 100644 --- a/lib/fog/hp/requests/block_storage/list_bootable_volumes.rb +++ b/lib/fog/hp/requests/block_storage/list_bootable_volumes.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # List existing block storage bootbale volumes diff --git a/lib/fog/hp/requests/block_storage/list_snapshots.rb b/lib/fog/hp/requests/block_storage/list_snapshots.rb index e2c594264..743d9cc83 100644 --- a/lib/fog/hp/requests/block_storage/list_snapshots.rb +++ b/lib/fog/hp/requests/block_storage/list_snapshots.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # List existing block storage snapshots diff --git a/lib/fog/hp/requests/block_storage/list_volumes.rb b/lib/fog/hp/requests/block_storage/list_volumes.rb index e17c45e9e..3ce4ecd40 100644 --- a/lib/fog/hp/requests/block_storage/list_volumes.rb +++ b/lib/fog/hp/requests/block_storage/list_volumes.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # List existing block storage volumes