mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
fixes for reset_data
instance method now, instead of class method resets data related to current connection/credentials
This commit is contained in:
parent
9bdf1ed585
commit
40cd1ff5e4
24 changed files with 145 additions and 167 deletions
|
@ -26,14 +26,13 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
@aws_access_key_id = options[:aws_access_key_id]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@aws_access_key_id)
|
||||
@data = self.class.data[@aws_access_key_id]
|
||||
end
|
||||
|
||||
|
|
|
@ -28,12 +28,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -43,13 +37,20 @@ module Fog
|
|||
end
|
||||
|
||||
require 'mime/types'
|
||||
@aws_access_key_id = options[:aws_access_key_id]
|
||||
@data = self.class.data[options[:region]][@aws_access_key_id]
|
||||
@aws_access_key_id = options[:aws_access_key_id]
|
||||
@region = options[:region]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data[@region].delete(@aws_access_key_id)
|
||||
@data = self.class.data[@region][@aws_access_key_id]
|
||||
end
|
||||
|
||||
def signature(params)
|
||||
"foo"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Real
|
||||
|
|
|
@ -22,12 +22,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -37,6 +31,11 @@ module Fog
|
|||
end
|
||||
|
||||
@rackspace_username = options[:rackspace_username]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@rackspace_username)
|
||||
@data = self.class.data[@rackspace_username]
|
||||
end
|
||||
|
||||
|
|
|
@ -134,8 +134,13 @@ module Fog
|
|||
|
||||
@aws_access_key_id = options[:aws_access_key_id]
|
||||
@region = options[:region] || 'us-east-1'
|
||||
@data = self.class.data[@region][@aws_access_key_id]
|
||||
@owner_id = @data[:owner_id]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data[@region].delete(@aws_access_key_id)
|
||||
@data = self.class.data[@region][@aws_access_key_id]
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -33,12 +33,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -48,6 +42,11 @@ module Fog
|
|||
end
|
||||
|
||||
@bluebox_api_key = options[:bluebox_api_key]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@bluebox_api_key)
|
||||
@data = self.class.data[@bluebox_api_key]
|
||||
end
|
||||
|
||||
|
|
|
@ -36,12 +36,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -52,6 +46,11 @@ module Fog
|
|||
|
||||
@go_grid_api_key = options[:go_grid_api_key]
|
||||
@go_grid_shared_secret = options[:go_grid_shared_secret]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@go_grid_api_key)
|
||||
@data = self.class.data[@go_grid_api_key]
|
||||
end
|
||||
|
||||
|
|
|
@ -31,12 +31,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -46,6 +40,11 @@ module Fog
|
|||
end
|
||||
|
||||
@linode_api_key = options[:linode_api_key]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@linode_api_key)
|
||||
@data = self.class.data[@linode_api_key]
|
||||
end
|
||||
|
||||
|
|
|
@ -25,12 +25,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -40,6 +34,11 @@ module Fog
|
|||
end
|
||||
|
||||
@new_server_username = options[:new_servers_username]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@new_server_username)
|
||||
@data = self.class.data[@new_server_username]
|
||||
end
|
||||
|
||||
|
|
|
@ -53,12 +53,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -68,6 +62,11 @@ module Fog
|
|||
end
|
||||
|
||||
@rackspace_username = options[:rackspace_username]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@rackspace_username)
|
||||
@data = self.class.data[@rackspace_username]
|
||||
end
|
||||
|
||||
|
|
|
@ -34,12 +34,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -49,6 +43,11 @@ module Fog
|
|||
end
|
||||
|
||||
@slicehost_password = options[:slicehost_password]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@slicehost_password)
|
||||
@data = self.class.data[@slicehost_password]
|
||||
end
|
||||
|
||||
|
|
|
@ -23,38 +23,41 @@ module Fog
|
|||
include Collections
|
||||
|
||||
def self.data
|
||||
@data ||= {
|
||||
:last_modified => { :servers => {}, :statuses => {}, :images => {} },
|
||||
:servers => [],
|
||||
:statuses => {},
|
||||
:images => [
|
||||
{'id' => 1, 'name' => "CentOS 4, 32-bit, base install"},
|
||||
{'id' => 2, 'name' => "CentOS 4, 64-bit, base install"},
|
||||
{'id' => 3, 'name' => "CentOS 5, 32-bit, base install"},
|
||||
{'id' => 4, 'name' => "CentOS 5, 64-bit, base install"},
|
||||
{'id' => 7, 'name' => "Fedora 10, 32-bit, base install"},
|
||||
{'id' => 8, 'name' => "Fedora 10, 64-bit, base install"},
|
||||
{'id' => 10, 'name' => "OpenSUSE 11, 64-bit, base install"},
|
||||
{'id' => 11, 'name' => "Debian 5.0 \"lenny\", 32-bit, base install"},
|
||||
{'id' => 12, 'name' => "Debian 5.0 \"lenny\", 64-bit, base install"},
|
||||
{'id' => 13, 'name' => "Ubuntu 8.04 \"Hardy\", 32-bit, base install"},
|
||||
{'id' => 14, 'name' => "Ubuntu 8.04 \"Hardy\", 64-bit, base install"},
|
||||
{'id' => 15, 'name' => "Voxel Server Environment (VSE), 32-bit, base install"},
|
||||
{'id' => 16, 'name' => "Voxel Server Environment (VSE), 64-bit, base install"},
|
||||
{'id' => 32, 'name' => "Pantheon Official Mercury Stack for Drupal (based on VSE/64)"},
|
||||
{'id' => 55, 'name' => "Ubuntu 10.04 \"Lucid\", 64-bit, base install"} ]
|
||||
}
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
@data ||= Hash.new do |hash, key|
|
||||
hash[key] = {
|
||||
:last_modified => { :servers => {}, :statuses => {}, :images => {} },
|
||||
:servers => [],
|
||||
:statuses => {},
|
||||
:images => [
|
||||
{'id' => 1, 'name' => "CentOS 4, 32-bit, base install"},
|
||||
{'id' => 2, 'name' => "CentOS 4, 64-bit, base install"},
|
||||
{'id' => 3, 'name' => "CentOS 5, 32-bit, base install"},
|
||||
{'id' => 4, 'name' => "CentOS 5, 64-bit, base install"},
|
||||
{'id' => 7, 'name' => "Fedora 10, 32-bit, base install"},
|
||||
{'id' => 8, 'name' => "Fedora 10, 64-bit, base install"},
|
||||
{'id' => 10, 'name' => "OpenSUSE 11, 64-bit, base install"},
|
||||
{'id' => 11, 'name' => "Debian 5.0 \"lenny\", 32-bit, base install"},
|
||||
{'id' => 12, 'name' => "Debian 5.0 \"lenny\", 64-bit, base install"},
|
||||
{'id' => 13, 'name' => "Ubuntu 8.04 \"Hardy\", 32-bit, base install"},
|
||||
{'id' => 14, 'name' => "Ubuntu 8.04 \"Hardy\", 64-bit, base install"},
|
||||
{'id' => 15, 'name' => "Voxel Server Environment (VSE), 32-bit, base install"},
|
||||
{'id' => 16, 'name' => "Voxel Server Environment (VSE), 64-bit, base install"},
|
||||
{'id' => 32, 'name' => "Pantheon Official Mercury Stack for Drupal (based on VSE/64)"},
|
||||
{'id' => 55, 'name' => "Ubuntu 10.04 \"Lucid\", 64-bit, base install"} ]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
@data = self.class.data
|
||||
@voxel_api_key = options[:voxel_api_key]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@voxel_api_key)
|
||||
@data = self.class.data[@voxel_api_key]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Real
|
||||
|
|
|
@ -9,10 +9,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=Mock.data.keys)
|
||||
Mock.reset_data(keys)
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def self.data
|
||||
|
|
|
@ -146,14 +146,6 @@ module Fog
|
|||
@recognized ||= []
|
||||
end
|
||||
|
||||
def reset_data(keys=Mock.data.keys)
|
||||
Mock.reset_data(keys)
|
||||
end
|
||||
|
||||
def reset_data(keys=Mock.data.keys)
|
||||
Mock.reset_data(keys)
|
||||
end
|
||||
|
||||
def validate_options(options)
|
||||
missing = requirements - options.keys
|
||||
unless missing.empty?
|
||||
|
|
|
@ -9,10 +9,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=Mock.data.keys)
|
||||
Mock.reset_data(keys)
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def self.data
|
||||
|
|
|
@ -33,12 +33,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -48,8 +42,14 @@ module Fog
|
|||
end
|
||||
|
||||
require 'mime/types'
|
||||
@aws_access_key_id = options[:aws_access_key_id]
|
||||
@data = self.class.data[options[:region]][@aws_access_key_id]
|
||||
@aws_access_key_id = options[:aws_access_key_id]
|
||||
@region = options[:region]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data[@region].delete(@aws_access_key_id)
|
||||
@data = self.class.data[@region][@aws_access_key_id]
|
||||
end
|
||||
|
||||
def signature(params)
|
||||
|
|
|
@ -30,12 +30,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -46,8 +40,12 @@ module Fog
|
|||
|
||||
@bluebox_customer_id = options[:bluebox_customer_id]
|
||||
@bluebox_api_key = options[:bluebox_api_key]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@bluebox_customer_id)
|
||||
@data = self.class.data[@bluebox_customer_id]
|
||||
@data = self.class.data[@bluebox_api_key]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -30,12 +30,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -47,8 +41,13 @@ module Fog
|
|||
@dnsimple_email = options[:dnsimple_email]
|
||||
@dnsimple_password = options[:dnsimple_password]
|
||||
@data = self.class.data[@dnsimple_email]
|
||||
@data = self.class.data[@dnsimple_password]
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@dnsimple_email)
|
||||
@data = self.class.data[@dnsimple_email]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Real
|
||||
|
|
|
@ -30,12 +30,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -45,6 +39,11 @@ module Fog
|
|||
end
|
||||
|
||||
@linode_api_key = options[:linode_api_key]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@linode_api_key)
|
||||
@data = self.class.data[@linode_api_key]
|
||||
end
|
||||
|
||||
|
|
|
@ -30,12 +30,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -45,6 +39,11 @@ module Fog
|
|||
end
|
||||
|
||||
@slicehost_password = options[:slicehost_password]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@slicehost_password)
|
||||
@data = self.class.data[@slicehost_password]
|
||||
end
|
||||
|
||||
|
|
|
@ -36,12 +36,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -52,8 +46,12 @@ module Fog
|
|||
|
||||
@zerigo_email = options[:zerigo_email]
|
||||
@zerigo_token = options[:zerigo_token]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@zerigo_email)
|
||||
@data = self.class.data[@zerigo_email]
|
||||
@data = self.class.data[@zerigo_password]
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -169,12 +169,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -201,12 +195,19 @@ module Fog
|
|||
else
|
||||
raise ArgumentError, "Unknown region: #{options[:region].inspect}"
|
||||
end
|
||||
@data = self.class.data[options[:region]][@aws_access_key_id]
|
||||
@region = options[:region]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data[@region].delete(@aws_access_key_id)
|
||||
@data = self.class.data[@region][@aws_access_key_id]
|
||||
end
|
||||
|
||||
def signature(params)
|
||||
"foo"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Real
|
||||
|
|
|
@ -140,12 +140,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -156,12 +150,18 @@ module Fog
|
|||
|
||||
require 'mime/types'
|
||||
@google_storage_access_key_id = options[:google_storage_access_key_id]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@google_storage_access_key_id)
|
||||
@data = self.class.data[@google_storage_access_key_id]
|
||||
end
|
||||
|
||||
def signature(params)
|
||||
"foo"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -19,12 +19,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
Fog::Mock.not_implemented
|
||||
|
||||
|
@ -37,7 +31,7 @@ module Fog
|
|||
end
|
||||
|
||||
@local_root = ::File.expand_path(options[:local_root])
|
||||
@data = self.class.data[@local_root]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def local_root
|
||||
|
@ -47,6 +41,12 @@ module Fog
|
|||
def path_to(partial)
|
||||
::File.join(@local_root, partial)
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@local_root)
|
||||
@data = self.class.data[@local_root]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Real
|
||||
|
|
|
@ -66,12 +66,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
|
@ -83,6 +77,11 @@ module Fog
|
|||
require 'mime/types'
|
||||
@rackspace_api_key = options[:rackspace_api_key]
|
||||
@rackspace_username = options[:rackspace_username]
|
||||
reset_data
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@rackspace_username)
|
||||
@data = self.class.data[@rackspace_username]
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue