fog 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/fog.gemspec +2 -2
- data/lib/fog.rb +1 -1
- data/lib/fog/aws.rb +2 -2
- data/lib/fog/aws/bin.rb +4 -2
- data/lib/fog/aws/models/compute/server.rb +15 -8
- data/lib/fog/aws/models/compute/servers.rb +9 -17
- data/lib/fog/aws/models/storage/file.rb +11 -0
- data/lib/fog/aws/requests/compute/modify_snapshot_attribute.rb +2 -2
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +4 -4
- data/lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb +1 -1
- data/lib/fog/aws/requests/elb/describe_instance_health.rb +1 -1
- data/lib/fog/aws/requests/elb/describe_load_balancers.rb +1 -1
- data/lib/fog/aws/requests/storage/get_object_url.rb +4 -4
- data/lib/fog/aws/requests/storage/put_object_url.rb +4 -4
- data/lib/fog/aws/storage.rb +4 -1
- data/lib/fog/rackspace/models/compute/server.rb +17 -8
- data/spec/aws/models/compute/key_pair_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -77
- data/spec/vcloud/models/vdc_spec.rb +1 -1
- data/tests/aws/helper.rb +1 -22
- data/tests/bluebox/helper.rb +1 -14
- data/tests/helper.rb +3 -2
- data/tests/linode/helper.rb +1 -14
- data/tests/rackspace/helper.rb +1 -16
- data/tests/slicehost/helper.rb +0 -15
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/fog.gemspec
CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
|
|
7
7
|
## If your rubyforge_project name is different, then edit it and comment out
|
8
8
|
## the sub! line in the Rakefile
|
9
9
|
s.name = 'fog'
|
10
|
-
s.version = '0.3.
|
11
|
-
s.date = '2010-09-
|
10
|
+
s.version = '0.3.1'
|
11
|
+
s.date = '2010-09-24'
|
12
12
|
s.rubyforge_project = 'fog'
|
13
13
|
|
14
14
|
## Make sure your summary is short. The description may be as long
|
data/lib/fog.rb
CHANGED
data/lib/fog/aws.rb
CHANGED
@@ -11,13 +11,13 @@ module Fog
|
|
11
11
|
service 'simpledb'
|
12
12
|
service 'storage'
|
13
13
|
|
14
|
-
def self.indexed_param(key, values
|
14
|
+
def self.indexed_param(key, values)
|
15
15
|
params = {}
|
16
16
|
unless key.include?('%d')
|
17
17
|
key << '.%d'
|
18
18
|
end
|
19
19
|
[*values].each_with_index do |value, index|
|
20
|
-
params[format(key, index +
|
20
|
+
params[format(key, index + 1)] = value
|
21
21
|
end
|
22
22
|
params
|
23
23
|
end
|
data/lib/fog/aws/bin.rb
CHANGED
@@ -14,7 +14,9 @@ class AWS < Fog::Bin
|
|
14
14
|
Fog::AWS::Compute.new
|
15
15
|
when :elb
|
16
16
|
Fog::AWS::ELB.new
|
17
|
-
when :
|
17
|
+
when :eu_storage
|
18
|
+
Fog::AWS::Storage.new(:region => 'eu-west-1')
|
19
|
+
when :sdb
|
18
20
|
Fog::AWS::SimpleDB.new
|
19
21
|
when :s3
|
20
22
|
location = caller.first
|
@@ -30,7 +32,7 @@ class AWS < Fog::Bin
|
|
30
32
|
end
|
31
33
|
|
32
34
|
def services
|
33
|
-
[:compute, :elb, :
|
35
|
+
[:compute, :elb, :sdb, :storage]
|
34
36
|
end
|
35
37
|
|
36
38
|
end
|
@@ -33,7 +33,7 @@ module Fog
|
|
33
33
|
attribute :user_data
|
34
34
|
|
35
35
|
attr_accessor :password, :username
|
36
|
-
attr_writer :private_key_path, :public_key_path
|
36
|
+
attr_writer :private_key, :private_key_path, :public_key, :public_key_path
|
37
37
|
|
38
38
|
def initialize(attributes={})
|
39
39
|
@groups ||= ["default"] unless attributes[:subnet_id]
|
@@ -79,7 +79,7 @@ module Fog
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def key_pair=(new_keypair)
|
82
|
-
@key_name = new_keypair.name
|
82
|
+
@key_name = new_keypair && new_keypair.name
|
83
83
|
end
|
84
84
|
|
85
85
|
def monitoring=(new_monitoring)
|
@@ -99,13 +99,20 @@ module Fog
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def private_key_path
|
102
|
-
@private_key_path ||= Fog.credentials[:private_key_path]
|
102
|
+
File.expand_path(@private_key_path ||= Fog.credentials[:private_key_path])
|
103
|
+
end
|
104
|
+
|
105
|
+
def private_key
|
106
|
+
@private_key ||= File.read(private_key_path)
|
103
107
|
end
|
104
108
|
|
105
109
|
def public_key_path
|
106
|
-
@public_key_path ||= Fog.credentials[:public_key_path]
|
110
|
+
File.expand_path(@public_key_path ||= Fog.credentials[:public_key_path])
|
107
111
|
end
|
108
112
|
|
113
|
+
def public_key
|
114
|
+
@public_key ||= File.read(public_key_path)
|
115
|
+
end
|
109
116
|
def ready?
|
110
117
|
@state == 'running'
|
111
118
|
end
|
@@ -147,11 +154,11 @@ module Fog
|
|
147
154
|
end
|
148
155
|
|
149
156
|
def setup(credentials = {})
|
150
|
-
requires :
|
157
|
+
requires :identity, :ip_address, :public_key, :username
|
151
158
|
sleep(10) # takes a bit before EC2 instances will play nice
|
152
159
|
Fog::SSH.new(ip_address, username, credentials).run([
|
153
160
|
%{mkdir .ssh},
|
154
|
-
%{echo "#{
|
161
|
+
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
155
162
|
%{passwd -l root},
|
156
163
|
%{echo "#{attributes.to_json}" >> ~/attributes.json}
|
157
164
|
])
|
@@ -161,8 +168,8 @@ module Fog
|
|
161
168
|
end
|
162
169
|
|
163
170
|
def ssh(commands)
|
164
|
-
requires :identity, :ip_address, :
|
165
|
-
@ssh ||= Fog::SSH.new(ip_address, username, :
|
171
|
+
requires :identity, :ip_address, :private_key, :username
|
172
|
+
@ssh ||= Fog::SSH.new(ip_address, username, :key_data => [private_key])
|
166
173
|
@ssh.run(commands)
|
167
174
|
end
|
168
175
|
|
@@ -9,8 +9,6 @@ module Fog
|
|
9
9
|
|
10
10
|
attribute :server_id
|
11
11
|
|
12
|
-
attr_writer :private_key_path, :public_key_path
|
13
|
-
|
14
12
|
model Fog::AWS::Compute::Server
|
15
13
|
|
16
14
|
def initialize(attributes)
|
@@ -31,10 +29,14 @@ module Fog
|
|
31
29
|
end
|
32
30
|
|
33
31
|
def bootstrap(new_attributes = {})
|
32
|
+
server = connection.servers.new(new_attributes)
|
33
|
+
|
34
34
|
# first or create fog_#{credential} keypair
|
35
|
-
unless key_pair = connection.key_pairs.get("fog_#{Fog.credential}")
|
36
|
-
|
37
|
-
|
35
|
+
unless server.key_pair = connection.key_pairs.get("fog_#{Fog.credential}")
|
36
|
+
server.key_pair = connection.key_pairs.create(
|
37
|
+
:name => "fog_#{Fog.credential}",
|
38
|
+
:public_key => server.public_key
|
39
|
+
)
|
38
40
|
end
|
39
41
|
|
40
42
|
# make sure port 22 is open in the first security group
|
@@ -49,11 +51,9 @@ module Fog
|
|
49
51
|
security_group.authorize_port_range(22..22)
|
50
52
|
end
|
51
53
|
|
54
|
+
server.save
|
52
55
|
server.wait_for { ready? }
|
53
|
-
|
54
|
-
server.setup(:key_data => [private_key])
|
55
|
-
|
56
|
-
server.merge_attributes(:private_key_path => private_key_path, :public_key_path => public_key_path)
|
56
|
+
server.setup(:key_data => [server.private_key])
|
57
57
|
server
|
58
58
|
end
|
59
59
|
|
@@ -65,14 +65,6 @@ module Fog
|
|
65
65
|
nil
|
66
66
|
end
|
67
67
|
|
68
|
-
def private_key_path
|
69
|
-
@private_key_path ||= Fog.credentials[:private_key_path]
|
70
|
-
end
|
71
|
-
|
72
|
-
def public_key_path
|
73
|
-
@public_key_path ||= Fog.credentials[:public_key_path]
|
74
|
-
end
|
75
|
-
|
76
68
|
end
|
77
69
|
|
78
70
|
end
|
@@ -17,6 +17,14 @@ module Fog
|
|
17
17
|
attribute :size, :aliases => 'Size'
|
18
18
|
attribute :storage_class, :aliases => 'StorageClass'
|
19
19
|
|
20
|
+
def acl=(new_acl)
|
21
|
+
valid_acls = ['private', 'public-read', 'public-read-write', 'authenticated-read']
|
22
|
+
unless valid_acls.include?(new_acl)
|
23
|
+
raise ArgumentError.new("acl must be one of [#{valid_acls.join(', ')}]")
|
24
|
+
end
|
25
|
+
@acl = new_acl
|
26
|
+
end
|
27
|
+
|
20
28
|
def body
|
21
29
|
@body ||= if last_modified && (file = collection.get(identity))
|
22
30
|
file.body
|
@@ -61,6 +69,9 @@ module Fog
|
|
61
69
|
|
62
70
|
def save(options = {})
|
63
71
|
requires :body, :directory, :key
|
72
|
+
if @acl
|
73
|
+
options['x-amz-acl'] = @acl
|
74
|
+
end
|
64
75
|
data = connection.put_object(directory.key, @key, @body, options)
|
65
76
|
@etag = data.headers['ETag']
|
66
77
|
true
|
@@ -12,8 +12,8 @@ module Fog
|
|
12
12
|
#
|
13
13
|
def modify_snapshot_attribute(snapshot_id, attribute, operation_type, options = {})
|
14
14
|
params = {}
|
15
|
-
params.merge!(AWS.indexed_param('UserId', options['UserId']
|
16
|
-
params.merge!(AWS.indexed_param('UserGroup', options['UserGroup']
|
15
|
+
params.merge!(AWS.indexed_param('UserId', options['UserId']))
|
16
|
+
params.merge!(AWS.indexed_param('UserGroup', options['UserGroup']))
|
17
17
|
request({
|
18
18
|
'Action' => 'ModifySnapshotAttribute',
|
19
19
|
'Attribute' => attribute,
|
@@ -22,7 +22,7 @@ module Fog
|
|
22
22
|
# * 'CreateLoadBalancerResult'<~Hash>:
|
23
23
|
# * 'DNSName'<~String> - DNS name for the newly created ELB
|
24
24
|
def create_load_balancer(availability_zones, lb_name, listeners)
|
25
|
-
params = ELB.indexed_param('AvailabilityZones.member', [*availability_zones]
|
25
|
+
params = ELB.indexed_param('AvailabilityZones.member', [*availability_zones])
|
26
26
|
|
27
27
|
listener_protocol = []
|
28
28
|
listener_lb_port = []
|
@@ -33,9 +33,9 @@ module Fog
|
|
33
33
|
listener_instance_port.push(listener['InstancePort'])
|
34
34
|
end
|
35
35
|
|
36
|
-
params.merge!(AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol
|
37
|
-
params.merge!(AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port
|
38
|
-
params.merge!(AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port
|
36
|
+
params.merge!(AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol))
|
37
|
+
params.merge!(AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port))
|
38
|
+
params.merge!(AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port))
|
39
39
|
|
40
40
|
request({
|
41
41
|
'Action' => 'CreateLoadBalancer',
|
@@ -20,7 +20,7 @@ module Fog
|
|
20
20
|
# * 'Instances'<~Array> - array of hashes describing instances currently enabled
|
21
21
|
# * 'InstanceId'<~String>
|
22
22
|
def deregister_instances_from_load_balancer(instance_ids, lb_name)
|
23
|
-
params = AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids]
|
23
|
+
params = AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids])
|
24
24
|
request({
|
25
25
|
'Action' => 'DeregisterInstancesFromLoadBalancer',
|
26
26
|
'LoadBalancerName' => lb_name,
|
@@ -23,7 +23,7 @@ module Fog
|
|
23
23
|
# * 'InstanceId'<~String>
|
24
24
|
# * 'ReasonCode'<~String>
|
25
25
|
def describe_instance_health(lb_name, instance_ids = [])
|
26
|
-
params = AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids]
|
26
|
+
params = AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids])
|
27
27
|
request({
|
28
28
|
'Action' => 'DescribeInstanceHealth',
|
29
29
|
'LoadBalancerName' => lb_name,
|
@@ -38,7 +38,7 @@ module Fog
|
|
38
38
|
# * 'AvailabilityZones'<~Array> - list of availability zones covered by this load balancer
|
39
39
|
# * 'Instances'<~Array> - list of instances that the load balancer balances between
|
40
40
|
def describe_load_balancers(lb_name = [])
|
41
|
-
params = AWS.indexed_param('LoadBalancerNames.member', [*lb_name]
|
41
|
+
params = AWS.indexed_param('LoadBalancerNames.member', [*lb_name])
|
42
42
|
request({
|
43
43
|
'Action' => 'DescribeLoadBalancers',
|
44
44
|
:parser => Fog::Parsers::AWS::ELB::DescribeLoadBalancers.new
|
@@ -23,9 +23,9 @@ module Fog
|
|
23
23
|
end
|
24
24
|
url({
|
25
25
|
:headers => {},
|
26
|
-
:host =>
|
26
|
+
:host => @host,
|
27
27
|
:method => 'GET',
|
28
|
-
:path => CGI.escape(object_name)
|
28
|
+
:path => [bucket_name, CGI.escape(object_name)].join('/')
|
29
29
|
}, expires)
|
30
30
|
end
|
31
31
|
|
@@ -42,9 +42,9 @@ module Fog
|
|
42
42
|
end
|
43
43
|
url({
|
44
44
|
:headers => {},
|
45
|
-
:host =>
|
45
|
+
:host => @host,
|
46
46
|
:method => 'GET',
|
47
|
-
:path => CGI.escape(object_name)
|
47
|
+
:path => [bucket_name, CGI.escape(object_name)].join('/')
|
48
48
|
}, expires)
|
49
49
|
end
|
50
50
|
|
@@ -23,9 +23,9 @@ module Fog
|
|
23
23
|
end
|
24
24
|
url({
|
25
25
|
:headers => {},
|
26
|
-
:host =>
|
26
|
+
:host => @host,
|
27
27
|
:method => 'PUT',
|
28
|
-
:path => CGI.escape(object_name)
|
28
|
+
:path => [bucket_name, CGI.escape(object_name)].join('/')
|
29
29
|
}, expires)
|
30
30
|
end
|
31
31
|
|
@@ -42,9 +42,9 @@ module Fog
|
|
42
42
|
end
|
43
43
|
url({
|
44
44
|
:headers => {},
|
45
|
-
:host =>
|
45
|
+
:host => @host,
|
46
46
|
:method => 'PUT',
|
47
|
-
:path => CGI.escape(object_name)
|
47
|
+
:path => [bucket_name, CGI.escape(object_name)].join('/')
|
48
48
|
}, expires)
|
49
49
|
end
|
50
50
|
|
data/lib/fog/aws/storage.rb
CHANGED
@@ -64,7 +64,8 @@ module Fog
|
|
64
64
|
query << "AWSAccessKeyId=#{@aws_access_key_id}"
|
65
65
|
query << "Signature=#{CGI.escape(signature(params))}"
|
66
66
|
query << "Expires=#{params[:headers]['Date']}"
|
67
|
-
|
67
|
+
bucket = params[:host].split('.').first
|
68
|
+
"https://#{@host}/#{params[:path]}?#{query.join('&')}"
|
68
69
|
end
|
69
70
|
|
70
71
|
end
|
@@ -124,6 +125,8 @@ module Fog
|
|
124
125
|
@hmac = Fog::HMAC.new('sha1', @aws_secret_access_key)
|
125
126
|
options[:region] ||= 'us-east-1'
|
126
127
|
@host = options[:host] || case options[:region]
|
128
|
+
when 'eu-west-1'
|
129
|
+
's3-eu-west-1.amazonaws.com'
|
127
130
|
when 'us-east-1'
|
128
131
|
's3.amazonaws.com'
|
129
132
|
when 'ap-southeast-1'
|
@@ -18,7 +18,8 @@ module Fog
|
|
18
18
|
attribute :progress
|
19
19
|
attribute :status
|
20
20
|
|
21
|
-
attr_accessor :password, :
|
21
|
+
attr_accessor :password, :username
|
22
|
+
attr_writer :private_key, :private_key_path, :public_key, :public_key_path
|
22
23
|
|
23
24
|
def initialize(attributes={})
|
24
25
|
@flavor_id ||= 1
|
@@ -57,11 +58,19 @@ module Fog
|
|
57
58
|
end
|
58
59
|
|
59
60
|
def private_key_path
|
60
|
-
@private_key_path ||= Fog.credentials[:private_key_path]
|
61
|
+
File.expand_path(@private_key_path ||= Fog.credentials[:private_key_path])
|
62
|
+
end
|
63
|
+
|
64
|
+
def private_key
|
65
|
+
@private_key ||= File.read(private_key_path)
|
61
66
|
end
|
62
67
|
|
63
68
|
def public_key_path
|
64
|
-
@public_key_path ||= Fog.credentials[:public_key_path]
|
69
|
+
File.expand_path(@public_key_path ||= Fog.credentials[:public_key_path])
|
70
|
+
end
|
71
|
+
|
72
|
+
def public_key
|
73
|
+
@public_key ||= File.read(public_key_path)
|
65
74
|
end
|
66
75
|
|
67
76
|
def save
|
@@ -78,10 +87,10 @@ module Fog
|
|
78
87
|
end
|
79
88
|
|
80
89
|
def setup(credentials = {})
|
81
|
-
requires :addresses, :identity, :
|
90
|
+
requires :addresses, :identity, :public_key, :username
|
82
91
|
Fog::SSH.new(addresses['public'].first, username, credentials).run([
|
83
92
|
%{mkdir .ssh},
|
84
|
-
%{echo "#{
|
93
|
+
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
85
94
|
%{passwd -l root},
|
86
95
|
%{echo "#{attributes.to_json}" >> ~/attributes.json},
|
87
96
|
%{echo "#{metadata.to_json}" >> ~/metadata.json}
|
@@ -92,13 +101,13 @@ module Fog
|
|
92
101
|
end
|
93
102
|
|
94
103
|
def ssh(commands)
|
95
|
-
requires :addresses, :identity, :
|
96
|
-
@ssh ||= Fog::SSH.new(addresses['public'].first, username, :
|
104
|
+
requires :addresses, :identity, :private_key, :username
|
105
|
+
@ssh ||= Fog::SSH.new(addresses['public'].first, username, :key_data => [private_key])
|
97
106
|
@ssh.run(commands)
|
98
107
|
end
|
99
108
|
|
100
109
|
def username
|
101
|
-
@username ||= root
|
110
|
+
@username ||= 'root'
|
102
111
|
end
|
103
112
|
|
104
113
|
private
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'spec'
|
2
2
|
require 'open-uri'
|
3
3
|
require 'fog'
|
4
|
+
Fog.bin = true
|
4
5
|
require 'fog/bin'
|
5
6
|
require 'fog/vcloud/bin'
|
6
7
|
|
@@ -8,83 +9,6 @@ if ENV["FOG_MOCK"] == "true"
|
|
8
9
|
Fog.mock!
|
9
10
|
end
|
10
11
|
|
11
|
-
module AWS
|
12
|
-
class << self
|
13
|
-
def [](service)
|
14
|
-
@@connections ||= Hash.new do |hash, key|
|
15
|
-
credentials = Fog.credentials.reject do |k, v|
|
16
|
-
![:aws_access_key_id, :aws_secret_access_key].include?(k)
|
17
|
-
end
|
18
|
-
hash[key] = case key
|
19
|
-
when :compute
|
20
|
-
Fog::AWS::Compute.new(credentials)
|
21
|
-
when :eu_storage
|
22
|
-
Fog::AWS::Storage.new(credentials.merge!(:host => 's3-external-3.amazonaws.com'))
|
23
|
-
when :sdb
|
24
|
-
Fog::AWS::SimpleDB.new(credentials)
|
25
|
-
when :storage
|
26
|
-
Fog::AWS::Storage.new(credentials)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
@@connections[service]
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
module Rackspace
|
35
|
-
class << self
|
36
|
-
def [](service)
|
37
|
-
@@connections ||= Hash.new do |hash, key|
|
38
|
-
credentials = Fog.credentials.reject do |k, v|
|
39
|
-
![:rackspace_api_key, :rackspace_username].include?(k)
|
40
|
-
end
|
41
|
-
hash[key] = case key
|
42
|
-
when :compute
|
43
|
-
Fog::Rackspace::Compute.new(credentials)
|
44
|
-
when :storage
|
45
|
-
Fog::Rackspace::Storage.new(credentials)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
@@connections[service]
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
module Slicehost
|
54
|
-
class << self
|
55
|
-
def [](service)
|
56
|
-
@@connections ||= Hash.new do |hash, key|
|
57
|
-
credentials = Fog.credentials.reject do |k, v|
|
58
|
-
![:slicehost_password].include?(k)
|
59
|
-
end
|
60
|
-
hash[key] = case key
|
61
|
-
when :compute
|
62
|
-
Fog::Slicehost::Compute.new(credentials)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
@@connections[service]
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
module Bluebox
|
71
|
-
class << self
|
72
|
-
def [](service)
|
73
|
-
@@connections ||= Hash.new do |hash, key|
|
74
|
-
credentials = Fog.credentials.reject do |k,v|
|
75
|
-
![:bluebox_api_key, :bluebox_customer_id].include?(k)
|
76
|
-
end
|
77
|
-
hash[key] = case key
|
78
|
-
when :compute
|
79
|
-
Fog::Bluebox::Compute.new(credentials)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
@@connections[service]
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
|
88
12
|
def eventually(max_delay = 16, &block)
|
89
13
|
delays = [0]
|
90
14
|
delay_step = 1
|
data/tests/aws/helper.rb
CHANGED
@@ -1,25 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class << self
|
4
|
-
def [](service)
|
5
|
-
@@connections ||= Hash.new do |hash, key|
|
6
|
-
credentials = Fog.credentials.reject do |k, v|
|
7
|
-
![:aws_access_key_id, :aws_secret_access_key].include?(k)
|
8
|
-
end
|
9
|
-
hash[key] = case key
|
10
|
-
when :compute
|
11
|
-
Fog::AWS::Compute.new(credentials)
|
12
|
-
when :eu_storage
|
13
|
-
Fog::AWS::Storage.new(credentials.merge!(:host => 's3-external-3.amazonaws.com'))
|
14
|
-
when :sdb
|
15
|
-
Fog::AWS::SimpleDB.new(credentials)
|
16
|
-
when :storage
|
17
|
-
Fog::AWS::Storage.new(credentials)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
@@connections[service]
|
21
|
-
end
|
22
|
-
end
|
1
|
+
class AWS
|
23
2
|
|
24
3
|
module Compute
|
25
4
|
|
data/tests/bluebox/helper.rb
CHANGED
@@ -1,17 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
def self.[](service)
|
4
|
-
@@connections ||= Hash.new do |hash, key|
|
5
|
-
credentials = Fog.credentials.reject do |k,v|
|
6
|
-
![:bluebox_api_key, :bluebox_customer_id].include?(k)
|
7
|
-
end
|
8
|
-
hash[key] = case key
|
9
|
-
when :compute
|
10
|
-
Fog::Bluebox::Compute.new(credentials)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
@@connections[service]
|
14
|
-
end
|
1
|
+
class Bluebox
|
15
2
|
|
16
3
|
module Compute
|
17
4
|
|
data/tests/helper.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'fog'
|
2
|
+
require 'fog/bin'
|
3
|
+
Fog.bin = true
|
3
4
|
|
4
5
|
require File.expand_path(File.join(File.dirname(__FILE__), 'helpers', 'model_helper'))
|
5
6
|
|
data/tests/linode/helper.rb
CHANGED
@@ -1,17 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
def self.[](service)
|
4
|
-
@@connections ||= Hash.new do |hash, key|
|
5
|
-
credentials = Fog.credentials.reject do |k,v|
|
6
|
-
![:linode_api_key].include?(k)
|
7
|
-
end
|
8
|
-
hash[key] = case key
|
9
|
-
when :compute
|
10
|
-
Fog::Linode::Compute.new(credentials)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
@@connections[service]
|
14
|
-
end
|
1
|
+
class Linode
|
15
2
|
|
16
3
|
module Compute
|
17
4
|
|
data/tests/rackspace/helper.rb
CHANGED
@@ -1,19 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
def self.[](service)
|
4
|
-
@@connections ||= Hash.new do |hash, key|
|
5
|
-
credentials = Fog.credentials.reject do |k, v|
|
6
|
-
![:rackspace_api_key, :rackspace_username].include?(k)
|
7
|
-
end
|
8
|
-
hash[key] = case key
|
9
|
-
when :compute
|
10
|
-
Fog::Rackspace::Compute.new(credentials)
|
11
|
-
when :storage
|
12
|
-
Fog::Rackspace::Storage.new(credentials)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
@@connections[service]
|
16
|
-
end
|
1
|
+
class Rackspace
|
17
2
|
|
18
3
|
module Compute
|
19
4
|
|
data/tests/slicehost/helper.rb
CHANGED
@@ -1,16 +1 @@
|
|
1
|
-
module Slicehost
|
2
1
|
|
3
|
-
def self.[](service)
|
4
|
-
@@connections ||= Hash.new do |hash, key|
|
5
|
-
credentials = Fog.credentials.reject do |k, v|
|
6
|
-
![:slicehost_password].include?(k)
|
7
|
-
end
|
8
|
-
hash[key] = case key
|
9
|
-
when :compute
|
10
|
-
Fog::Slicehost::Compute.new(credentials)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
@@connections[service]
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 1
|
9
|
+
version: 0.3.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- geemus (Wesley Beary)
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-09-
|
17
|
+
date: 2010-09-24 00:00:00 -07:00
|
18
18
|
default_executable: fog
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|