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

leftovers that I missed on the first pass in the last few commits

This commit is contained in:
geemus 2010-09-08 14:00:43 -07:00
parent 58577e17bf
commit eb6bca6f34
20 changed files with 64 additions and 22 deletions

View file

@ -10,6 +10,12 @@ module Bluebox
def [](service) def [](service)
@@connections ||= Hash.new do |hash, key| @@connections ||= Hash.new do |hash, key|
hash[key] = case key hash[key] = case key
when :blocks
location = caller.first
warning = "[yellow][WARN] Bluebox[:blocks] is deprecated, use Bluebox[:compute] instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
Fog::Bluebox::Compute.new
when :compute when :compute
Fog::Bluebox::Compute.new Fog::Bluebox::Compute.new
end end

View file

@ -72,7 +72,7 @@ module Fog
rescue Excon::Errors::Error => error rescue Excon::Errors::Error => error
raise case error raise case error
when Excon::Errors::NotFound when Excon::Errors::NotFound
Fog::Bluebox::NotFound.slurp(error) Fog::Bluebox::Compute::NotFound.slurp(error)
else else
error error
end end

View file

@ -1,5 +1,5 @@
require 'fog/collection' require 'fog/collection'
require 'fog/bluebox/models/flavor' require 'fog/bluebox/models/compute/flavor'
module Fog module Fog
module Bluebox module Bluebox
@ -7,7 +7,7 @@ module Fog
class Flavors < Fog::Collection class Flavors < Fog::Collection
model Fog::Bluebox::Flavor model Fog::Bluebox::Compute::Flavor
def all def all
data = connection.get_products.body data = connection.get_products.body
@ -17,7 +17,7 @@ module Fog
def get(product_id) def get(product_id)
response = connection.get_product(product_id) response = connection.get_product(product_id)
new(response.body) new(response.body)
rescue Fog::Bluebox::NotFound rescue Fog::Bluebox::Compute::NotFound
nil nil
end end

View file

@ -1,5 +1,5 @@
require 'fog/collection' require 'fog/collection'
require 'fog/bluebox/models/image' require 'fog/bluebox/models/compute/image'
module Fog module Fog
module Bluebox module Bluebox
@ -7,7 +7,7 @@ module Fog
class Images < Fog::Collection class Images < Fog::Collection
model Fog::Bluebox::Image model Fog::Bluebox::Compute::Image
def all def all
data = connection.get_templates.body data = connection.get_templates.body
@ -17,7 +17,7 @@ module Fog
def get(template_id) def get(template_id)
response = connection.get_template(template_id) response = connection.get_template(template_id)
new(response.body) new(response.body)
rescue Fog::Bluebox::NotFound rescue Fog::Bluebox::Compute::NotFound
nil nil
end end

View file

@ -1,5 +1,5 @@
require 'fog/collection' require 'fog/collection'
require 'fog/bluebox/models/server' require 'fog/bluebox/models/compute/server'
module Fog module Fog
module Bluebox module Bluebox
@ -7,7 +7,7 @@ module Fog
class Servers < Fog::Collection class Servers < Fog::Collection
model Fog::Bluebox::Server model Fog::Bluebox::Compute::Server
def all def all
data = connection.get_blocks.body data = connection.get_blocks.body
@ -18,7 +18,7 @@ module Fog
if server_id && server = connection.get_block(server_id).body if server_id && server = connection.get_block(server_id).body
new(server) new(server)
end end
rescue Fog::Bluebox::NotFound rescue Fog::Bluebox::Compute::NotFound
nil nil
end end

View file

@ -11,6 +11,12 @@ module GoGrid
hash[key] = case key hash[key] = case key
when :compute when :compute
Fog::GoGrid::Compute.new Fog::GoGrid::Compute.new
when :servers
location = caller.first
warning = "[yellow][WARN] GoGrid[:servers] is deprecated, use GoGrid[:compute] instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
Fog::GoGrid::Compute.new
end end
end end
@@connections[service] @@connections[service]

View file

@ -79,7 +79,7 @@ module Fog
rescue Excon::Errors::Error => error rescue Excon::Errors::Error => error
raise case error raise case error
when Excon::Errors::NotFound when Excon::Errors::NotFound
Fog::Go_Grid::NotFound.slurp(error) Fog::GoGrid::Compute::NotFound.slurp(error)
else else
error error
end end

View file

@ -11,6 +11,12 @@ module Linode
hash[key] = case key hash[key] = case key
when :compute when :compute
Fog::Linode::Compute.new Fog::Linode::Compute.new
when :linode
location = caller.first
warning = "[yellow][WARN] Linode[:linode] is deprecated, use Linode[:compute] instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
Fog::Linode::Compute.new
end end
end end
@@connections[service] @@connections[service]

View file

@ -65,9 +65,9 @@ module Fog
if data = response.body['ERRORARRAY'].first if data = response.body['ERRORARRAY'].first
error = case data['ERRORCODE'] error = case data['ERRORCODE']
when 5 when 5
Fog::Linode::NotFound Fog::Linode::Compute::NotFound
else else
Fog::Linode::Error Fog::Linode::Compute::Error
end end
raise error.new(data['ERRORMESSAGE']) raise error.new(data['ERRORMESSAGE'])
end end

View file

@ -9,6 +9,12 @@ module Local
def [](service) def [](service)
@@connections ||= Hash.new do |hash, key| @@connections ||= Hash.new do |hash, key|
hash[key] = case key hash[key] = case key
when :files
location = caller.first
warning = "[yellow][WARN] Local[:files] is deprecated, use Local[:storage] instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
Fog::Local::Storage.new
when :storage when :storage
Fog::Local::Storage.new Fog::Local::Storage.new
end end

View file

@ -1,5 +1,5 @@
require 'fog/model' require 'fog/model'
# require 'fog/local/models/files' require 'fog/local/models/storage/files'
module Fog module Fog
module Local module Local

View file

@ -1,5 +1,5 @@
require 'fog/collection' require 'fog/collection'
require 'fog/local/models/file' require 'fog/local/models/storage/file'
module Fog module Fog
module Local module Local

View file

@ -11,6 +11,12 @@ module NewServers
hash[key] = case key hash[key] = case key
when :compute when :compute
Fog::NewServers::Compute.new Fog::NewServers::Compute.new
when :new_servers
location = caller.first
warning = "[yellow][WARN] NewServers[:servers] is deprecated, use NewServers[:compute] instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
Fog::NewServers::Compute.new
end end
end end
@@connections[service] @@connections[service]

View file

@ -75,7 +75,7 @@ module Fog
rescue Excon::Errors::Error => error rescue Excon::Errors::Error => error
raise case error raise case error
when Excon::Errors::NotFound when Excon::Errors::NotFound
Fog::NewServers::NotFound.slurp(error) Fog::NewServers::Compute::NotFound.slurp(error)
else else
error error
end end

View file

@ -11,6 +11,18 @@ module Rackspace
hash[key] = case key hash[key] = case key
when :compute when :compute
Fog::Rackspace::Compute.new Fog::Rackspace::Compute.new
when :files
location = caller.first
warning = "[yellow][WARN] Rackspace[:files] is deprecated, use Rackspace[:storage] instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
Fog::Rackspace::Storage.new
when :servers
location = caller.first
warning = "[yellow][WARN] Rackspace[:servers] is deprecated, use Rackspace[:compute] instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
Fog::Rackspace::Compute.new
when :storage when :storage
Fog::Rackspace::Storage.new Fog::Rackspace::Storage.new
end end

View file

@ -1,5 +1,5 @@
require 'fog/collection' require 'fog/collection'
require 'fog/rackspace/models/servers/flavor' require 'fog/rackspace/models/compute/flavor'
module Fog module Fog
module Rackspace module Rackspace

View file

@ -1,5 +1,5 @@
require 'fog/collection' require 'fog/collection'
require 'fog/rackspace/models/servers/image' require 'fog/rackspace/models/compute/image'
module Fog module Fog
module Rackspace module Rackspace

View file

@ -1,5 +1,5 @@
require 'fog/collection' require 'fog/collection'
require 'fog/rackspace/models/servers/server' require 'fog/rackspace/models/compute/server'
module Fog module Fog
module Rackspace module Rackspace

View file

@ -1,5 +1,5 @@
require 'fog/model' require 'fog/model'
require 'fog/rackspace/models/files/files' require 'fog/rackspace/models/storage/files'
module Fog module Fog
module Rackspace module Rackspace
@ -25,7 +25,7 @@ module Fog
def files def files
@files ||= begin @files ||= begin
Fog::Rackspace::Files::Files.new( Fog::Rackspace::Storage::Files.new(
:directory => self, :directory => self,
:connection => connection :connection => connection
) )

View file

@ -1,5 +1,5 @@
require 'fog/collection' require 'fog/collection'
require 'fog/rackspace/models/files/file' require 'fog/rackspace/models/storage/file'
module Fog module Fog
module Rackspace module Rackspace