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

Merge pull request #774 from jwang/baremetalcloud

Rename from NewServers to BareMetalCloud
This commit is contained in:
Wesley Beary 2012-03-04 16:07:59 -08:00
commit defb7ccf1b
17 changed files with 44 additions and 40 deletions

View file

@ -602,8 +602,8 @@ MVP! Patrick Debois
[compute|linode]
move linode compute to its own shared area (namespacing should probably be corrected). thanks geemus
[compute|new_servers]
move new_servers compute to its own shared area (namespacing should probably be corrected). thanks geemus
[compute|bare_metal_cloud]
move bare_metal_cloud compute to its own shared area (namespacing should probably be corrected). thanks geemus
[compute|ninefold]
move ninefold compute to its own shared area (namespacing should probably be corrected). thanks geemus

View file

@ -1,11 +1,11 @@
require(File.expand_path(File.join(File.dirname(__FILE__), 'core')))
module Fog
module NewServers
module BareMetalCloud
extend Fog::Provider
service(:compute, 'new_servers/compute', 'Compute')
service(:compute, 'bare_metal_cloud/compute', 'Compute')
end
end

View file

@ -1,16 +1,16 @@
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'new_servers'))
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'bare_metal_cloud'))
require 'fog/compute'
module Fog
module Compute
class NewServers < Fog::Service
class BareMetalCloud < Fog::Service
requires :new_servers_password, :new_servers_username
requires :bare_metal_cloud_password, :bare_metal_cloud_username
recognizes :host, :port, :scheme, :persistent
model_path 'fog/new_servers/models/compute'
model_path 'fog/bare_metal_cloud/models/compute'
request_path 'fog/new_servers/requests/compute'
request_path 'fog/bare_metal_cloud/requests/compute'
request :add_server
request :cancel_server
request :get_server
@ -32,15 +32,15 @@ module Fog
end
def initialize(options={})
@new_server_username = options[:new_servers_username]
@bare_metal_cloud_username = options[:bare_metal_cloud_username]
end
def data
self.class.data[@new_server_username]
self.class.data[@bare_metal_cloud_username]
end
def reset_data
self.class.data.delete(@new_server_username)
self.class.data.delete(@bare_metal_cloud_username)
end
end
@ -50,10 +50,10 @@ module Fog
def initialize(options={})
require 'fog/core/parser'
@new_servers_password = options[:new_servers_password]
@new_servers_username = options[:new_servers_username]
@bare_metal_cloud_password = options[:bare_metal_cloud_password]
@bare_metal_cloud_username = options[:bare_metal_cloud_username]
@connection_options = options[:connection_options] || {}
@host = options[:host] || "noc.newservers.com"
@host = options[:host] || "noc.baremetalcloud.com"
@persistent = options[:persistent] || false
@port = options[:port] || 443
@scheme = options[:scheme] || 'https'
@ -67,8 +67,8 @@ module Fog
def request(params)
params[:query] ||= {}
params[:query].merge!({
:password => @new_servers_password,
:username => @new_servers_username
:password => @bare_metal_cloud_password,
:username => @bare_metal_cloud_username
})
params[:headers] ||= {}
case params[:method]
@ -83,7 +83,7 @@ module Fog
rescue Excon::Errors::HTTPStatusError => error
raise case error
when Excon::Errors::NotFound
Fog::Compute::NewServers::NotFound.slurp(error)
Fog::Compute::BareMetalCloud::NotFound.slurp(error)
else
error
end

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class NewServers
class BareMetalCloud
class Real
# Boot a new server

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class NewServers
class BareMetalCloud
class Real
# Shutdown a running server

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class NewServers
class BareMetalCloud
class Real
# List servers

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class NewServers
class BareMetalCloud
class Real
# List images

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class NewServers
class BareMetalCloud
class Real
# List available plans

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class NewServers
class BareMetalCloud
class Real
# List servers

View file

@ -1,6 +1,6 @@
module Fog
module Compute
class NewServers
class BareMetalCloud
class Real
# Reboot a running server

View file

@ -68,7 +68,7 @@ require 'fog/bin/joyent'
require 'fog/bin/libvirt'
require 'fog/bin/linode'
require 'fog/bin/local'
require 'fog/bin/new_servers'
require 'fog/bin/bare_metal_cloud'
require 'fog/bin/ninefold'
require 'fog/bin/rackspace'
require 'fog/bin/openstack'

View file

@ -1,10 +1,10 @@
class NewServers < Fog::Bin
class BareMetalCloud < Fog::Bin
class << self
def class_for(key)
case key
when :compute
Fog::Compute::NewServers
Fog::Compute::BareMetalCloud
else
raise ArgumentError, "Unsupported #{self} service: #{key}"
end
@ -14,8 +14,8 @@ class NewServers < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Logger.warning("NewServers[:compute] is not recommended, use Compute[:newservers] for portability")
Fog::Compute.new(:provider => 'NewServers')
Fog::Logger.warning("BareMetalCloud[:compute] is not recommended, use Compute[:baremetalcloud] for portability")
Fog::Compute.new(:provider => 'BareMetalCloud')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"
end
@ -24,7 +24,7 @@ class NewServers < Fog::Bin
end
def services
Fog::NewServers.services
Fog::BareMetalCloud.services
end
end

View file

@ -41,9 +41,13 @@ module Fog
when :linode
require 'fog/linode/compute'
Fog::Compute::Linode.new(attributes)
when :newservers
require 'fog/new_servers/compute'
Fog::Compute::NewServers.new(attributes)
when :new_servers
require 'fog/bare_metal_cloud/compute'
warn "[DEPRECATION] `new_servers` is deprecated. Please use `bare_metal_cloud` instead."
Fog::Compute::BareMetalCloud.new(attributes)
when :baremetalcloud
require 'fog/bare_metal_cloud/compute'
Fog::Compute::BareMetalCloud.new(attributes)
when :ninefold
require 'fog/ninefold/compute'
Fog::Compute::Ninefold.new(attributes)

View file

@ -46,8 +46,8 @@ An alternate file may be used by placing its path in the FOG_RC environment vari
:google_storage_secret_access_key:
:linode_api_key:
:local_root:
:new_servers_password:
:new_servers_username:
:bare_metal_cloud_password:
:bare_metal_cloud_username:
:public_key_path:
:private_key_path:
:openstack_api_key:

View file

@ -14,7 +14,7 @@ require 'fog/joyent'
require 'fog/libvirt'
require 'fog/linode'
require 'fog/local'
require 'fog/new_servers'
require 'fog/bare_metal_cloud'
require 'fog/ninefold'
require 'fog/rackspace'
require 'fog/openstack'

View file

@ -12,7 +12,7 @@ def array_differences(array_a, array_b)
end
# check to see which credentials are available and add others to the skipped tags list
all_providers = ['aws', 'bluebox', 'brightbox', 'dnsimple', 'dnsmadeeasy', 'dynect', 'ecloud', 'glesys', 'gogrid', 'google', 'joyent', 'linode', 'local', 'ninefold', 'newservers', 'openstack', 'ovirt', 'rackspace', 'slicehost', 'stormondemand', 'voxel', 'vsphere', 'zerigo']
all_providers = ['aws', 'bluebox', 'brightbox', 'dnsimple', 'dnsmadeeasy', 'dynect', 'ecloud', 'glesys', 'gogrid', 'google', 'joyent', 'linode', 'local', 'ninefold', 'baremetalcloud', 'openstack', 'ovirt', 'rackspace', 'slicehost', 'stormondemand', 'voxel', 'vsphere', 'zerigo']
available_providers = Fog.available_providers.map {|provider| provider.downcase}
for provider in (all_providers - available_providers)
Formatador.display_line("[yellow]Skipping tests for [bold]#{provider}[/] [yellow]due to lacking credentials (add some to '~/.fog' to run them)[/]")

View file

@ -34,8 +34,8 @@ if Fog.mock?
:joyent_password => "joyentpass",
:linode_api_key => 'linode_api_key',
:local_root => '~/.fog',
:new_servers_password => 'new_servers_password',
:new_servers_username => 'new_servers_username',
:bare_metal_cloud_password => 'bare_metal_cloud_password',
:bare_metal_cloud_username => 'bare_metal_cloud_username',
:ninefold_compute_key => 'ninefold_compute_key',
:ninefold_compute_secret => 'ninefold_compute_secret',
:ninefold_storage_secret => 'ninefold_storage_secret',