fog 0.3.22 → 0.3.23
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/models/compute/address.rb +6 -5
- data/lib/fog/aws/models/compute/addresses.rb +3 -3
- data/lib/fog/aws/models/compute/image.rb +7 -11
- data/lib/fog/aws/models/compute/images.rb +3 -3
- data/lib/fog/aws/models/compute/key_pair.rb +1 -1
- data/lib/fog/aws/models/compute/key_pairs.rb +4 -3
- data/lib/fog/aws/models/compute/security_group.rb +6 -6
- data/lib/fog/aws/models/compute/security_groups.rb +3 -3
- data/lib/fog/aws/models/compute/server.rb +15 -44
- data/lib/fog/aws/models/compute/servers.rb +3 -5
- data/lib/fog/aws/models/compute/snapshot.rb +4 -4
- data/lib/fog/aws/models/compute/snapshots.rb +3 -3
- data/lib/fog/aws/models/compute/tags.rb +4 -4
- data/lib/fog/aws/models/compute/volume.rb +7 -7
- data/lib/fog/aws/models/compute/volumes.rb +4 -4
- data/lib/fog/aws/models/storage/directories.rb +1 -1
- data/lib/fog/aws/models/storage/file.rb +9 -5
- data/lib/fog/aws/models/storage/files.rb +10 -9
- data/lib/fog/aws/parsers/storage/get_bucket.rb +19 -3
- data/lib/fog/aws/requests/storage/get_bucket.rb +1 -0
- data/lib/fog/bluebox/models/compute/server.rb +7 -13
- data/lib/fog/brightbox/models/compute/image.rb +4 -4
- data/lib/fog/brightbox/models/compute/server.rb +7 -7
- data/lib/fog/brightbox/models/compute/user.rb +3 -3
- data/lib/fog/core/attributes.rb +18 -26
- data/lib/fog/go_grid/models/compute/image.rb +2 -2
- data/lib/fog/go_grid/models/compute/server.rb +2 -2
- data/lib/fog/google/models/storage/directories.rb +1 -1
- data/lib/fog/google/models/storage/file.rb +9 -6
- data/lib/fog/google/models/storage/files.rb +10 -9
- data/lib/fog/google/parsers/storage/get_bucket.rb +19 -3
- data/lib/fog/google/requests/storage/get_bucket.rb +1 -0
- data/lib/fog/local/models/storage/file.rb +5 -2
- data/lib/fog/rackspace/models/compute/image.rb +3 -3
- data/lib/fog/rackspace/models/compute/server.rb +10 -10
- data/lib/fog/rackspace/models/storage/file.rb +8 -5
- data/lib/fog/rackspace/models/storage/files.rb +4 -4
- data/lib/fog/slicehost/models/compute/server.rb +7 -7
- data/lib/fog/terremark/models/shared/address.rb +2 -2
- data/lib/fog/terremark/models/shared/network.rb +2 -2
- data/lib/fog/terremark/models/shared/server.rb +13 -13
- data/lib/fog/terremark/models/shared/task.rb +3 -3
- data/lib/fog/terremark/models/shared/vdc.rb +4 -4
- 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-11-
|
10
|
+
s.version = '0.3.23'
|
11
|
+
s.date = '2010-11-19'
|
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
@@ -19,7 +19,7 @@ module Fog
|
|
19
19
|
def destroy
|
20
20
|
requires :public_ip
|
21
21
|
|
22
|
-
connection.release_address(
|
22
|
+
connection.release_address(public_ip)
|
23
23
|
true
|
24
24
|
end
|
25
25
|
|
@@ -33,8 +33,9 @@ module Fog
|
|
33
33
|
|
34
34
|
def save
|
35
35
|
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
|
36
|
-
data = connection.allocate_address
|
37
|
-
|
36
|
+
data = connection.allocate_address.body
|
37
|
+
new_attributes = data.reject {|key,value| key == 'requestId'}
|
38
|
+
merge_attributes(new_attributes)
|
38
39
|
if @server
|
39
40
|
self.server = @server
|
40
41
|
end
|
@@ -48,14 +49,14 @@ module Fog
|
|
48
49
|
@server = new_server
|
49
50
|
else
|
50
51
|
@server = nil
|
51
|
-
|
52
|
+
self.server_id = new_server.id
|
52
53
|
connection.associate_address(@server_id, @public_ip)
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
56
57
|
def disassociate
|
57
58
|
@server = nil
|
58
|
-
|
59
|
+
self.server_id = nil
|
59
60
|
unless new_record?
|
60
61
|
connection.disassociate_address(@public_ip)
|
61
62
|
end
|
@@ -13,16 +13,16 @@ module Fog
|
|
13
13
|
model Fog::AWS::Compute::Address
|
14
14
|
|
15
15
|
def initialize(attributes)
|
16
|
-
|
16
|
+
self.filters ||= {}
|
17
17
|
super
|
18
18
|
end
|
19
19
|
|
20
|
-
def all(filters =
|
20
|
+
def all(filters = filters)
|
21
21
|
unless filters.is_a?(Hash)
|
22
22
|
Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('public-ip' => []) instead[/] [light_black](#{caller.first})[/]")
|
23
23
|
filters = {'public-ip' => [*filters]}
|
24
24
|
end
|
25
|
-
|
25
|
+
self.filters = filters
|
26
26
|
data = connection.describe_addresses(filters).body
|
27
27
|
load(
|
28
28
|
data['addressesSet'].map do |address|
|
@@ -24,18 +24,14 @@ module Fog
|
|
24
24
|
attribute :tags, :aliases => 'tagSet'
|
25
25
|
|
26
26
|
def deregister(delete_snapshot = false)
|
27
|
-
connection.deregister_image(
|
28
|
-
|
29
|
-
if(delete_snapshot && @root_device_type=="ebs")
|
30
|
-
@block_device_mapping.each do |block_device|
|
31
|
-
next if block_device["deviceName"] != @root_device_name
|
32
|
-
snapshot_id = block_device["snapshotId"]
|
33
|
-
snapshot = @connection.snapshots.get(snapshot_id)
|
34
|
-
return snapshot.destroy
|
35
|
-
end
|
36
|
-
end
|
27
|
+
connection.deregister_image(id)
|
37
28
|
|
38
|
-
|
29
|
+
if(delete_snapshot && root_device_type == "ebs")
|
30
|
+
block_device = block_device_mapping.select {|block_device| block_device['deviceName'] == root_device_name}
|
31
|
+
@connection.snapshots.new(:id => block_device['snapshotId']).destroy
|
32
|
+
else
|
33
|
+
true
|
34
|
+
end
|
39
35
|
end
|
40
36
|
|
41
37
|
end
|
@@ -12,13 +12,13 @@ module Fog
|
|
12
12
|
model Fog::AWS::Compute::Image
|
13
13
|
|
14
14
|
def initialize(attributes)
|
15
|
-
|
15
|
+
self.filters ||= {}
|
16
16
|
super
|
17
17
|
end
|
18
18
|
|
19
19
|
def all(filters = @filters)
|
20
|
-
|
21
|
-
data = connection.describe_images(
|
20
|
+
self.filters = filters
|
21
|
+
data = connection.describe_images(filters).body
|
22
22
|
load(data['imagesSet'])
|
23
23
|
end
|
24
24
|
|
@@ -7,21 +7,22 @@ module Fog
|
|
7
7
|
|
8
8
|
class KeyPairs < Fog::Collection
|
9
9
|
|
10
|
+
attribute :filters
|
10
11
|
attribute :key_name
|
11
12
|
|
12
13
|
model Fog::AWS::Compute::KeyPair
|
13
14
|
|
14
15
|
def initialize(attributes)
|
15
|
-
|
16
|
+
self.filters ||= {}
|
16
17
|
super
|
17
18
|
end
|
18
19
|
|
19
|
-
def all(filters =
|
20
|
+
def all(filters = filters)
|
20
21
|
unless filters.is_a?(Hash)
|
21
22
|
Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('key-name' => []) instead[/] [light_black](#{caller.first})[/]")
|
22
23
|
filters = {'key-name' => [*filters]}
|
23
24
|
end
|
24
|
-
|
25
|
+
self.filters = filters
|
25
26
|
data = connection.describe_key_pairs(filters).body
|
26
27
|
load(data['keySet'])
|
27
28
|
end
|
@@ -16,7 +16,7 @@ module Fog
|
|
16
16
|
requires :name
|
17
17
|
|
18
18
|
connection.authorize_security_group_ingress(
|
19
|
-
'GroupName' =>
|
19
|
+
'GroupName' => name,
|
20
20
|
'SourceSecurityGroupName' => group,
|
21
21
|
'SourceSecurityGroupOwnerId' => owner
|
22
22
|
)
|
@@ -28,7 +28,7 @@ module Fog
|
|
28
28
|
connection.authorize_security_group_ingress(
|
29
29
|
'CidrIp' => options[:cidr_ip] || '0.0.0.0/0',
|
30
30
|
'FromPort' => range.min,
|
31
|
-
'GroupName' =>
|
31
|
+
'GroupName' => name,
|
32
32
|
'ToPort' => range.max,
|
33
33
|
'IpProtocol' => options[:ip_protocol] || 'tcp'
|
34
34
|
)
|
@@ -37,7 +37,7 @@ module Fog
|
|
37
37
|
def destroy
|
38
38
|
requires :name
|
39
39
|
|
40
|
-
connection.delete_security_group(
|
40
|
+
connection.delete_security_group(name)
|
41
41
|
true
|
42
42
|
end
|
43
43
|
|
@@ -45,7 +45,7 @@ module Fog
|
|
45
45
|
requires :name
|
46
46
|
|
47
47
|
connection.revoke_security_group_ingress(
|
48
|
-
'GroupName' =>
|
48
|
+
'GroupName' => name,
|
49
49
|
'SourceSecurityGroupName' => group,
|
50
50
|
'SourceSecurityGroupOwnerId' => owner
|
51
51
|
)
|
@@ -57,7 +57,7 @@ module Fog
|
|
57
57
|
connection.revoke_security_group_ingress(
|
58
58
|
'CidrIp' => options[:cidr_ip] || '0.0.0.0/0',
|
59
59
|
'FromPort' => range.min,
|
60
|
-
'GroupName' =>
|
60
|
+
'GroupName' => name,
|
61
61
|
'ToPort' => range.max,
|
62
62
|
'IpProtocol' => options[:ip_protocol] || 'tcp'
|
63
63
|
)
|
@@ -66,7 +66,7 @@ module Fog
|
|
66
66
|
def save
|
67
67
|
requires :description, :name
|
68
68
|
|
69
|
-
data = connection.create_security_group(
|
69
|
+
data = connection.create_security_group(name, description).body
|
70
70
|
true
|
71
71
|
end
|
72
72
|
|
@@ -12,16 +12,16 @@ module Fog
|
|
12
12
|
model Fog::AWS::Compute::SecurityGroup
|
13
13
|
|
14
14
|
def initialize(attributes)
|
15
|
-
|
15
|
+
self.filters ||= {}
|
16
16
|
super
|
17
17
|
end
|
18
18
|
|
19
|
-
def all(filters =
|
19
|
+
def all(filters = filters)
|
20
20
|
unless filters.is_a?(Hash)
|
21
21
|
Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('group-name' => []) instead[/] [light_black](#{caller.first})[/]")
|
22
22
|
filters = {'group-name' => [*filters]}
|
23
23
|
end
|
24
|
-
|
24
|
+
self.filters = filters
|
25
25
|
data = connection.describe_security_groups(@filters).body
|
26
26
|
load(data['securityGroupInfo'])
|
27
27
|
end
|
@@ -10,7 +10,7 @@ module Fog
|
|
10
10
|
|
11
11
|
attr_accessor :architecture
|
12
12
|
attribute :ami_launch_index, :aliases => 'amiLaunchIndex'
|
13
|
-
attribute :availability_zone, :aliases => ['availabilityZone', 'placement']
|
13
|
+
attribute :availability_zone, :aliases => ['availabilityZone', 'placement'], :squash => 'availabilityZone'
|
14
14
|
attribute :block_device_mapping, :aliases => 'blockDeviceMapping'
|
15
15
|
attribute :client_token, :aliases => 'clientToken'
|
16
16
|
attribute :dns_name, :aliases => 'dnsName'
|
@@ -22,7 +22,7 @@ module Fog
|
|
22
22
|
attribute :kernel_id, :aliases => 'kernelId'
|
23
23
|
attribute :key_name, :aliases => 'keyName'
|
24
24
|
attribute :created_at, :aliases => 'launchTime'
|
25
|
-
attribute :monitoring
|
25
|
+
attribute :monitoring, :squash => 'state'
|
26
26
|
attribute :product_codes, :aliases => 'productCodes'
|
27
27
|
attribute :private_dns_name, :aliases => 'privateDnsName'
|
28
28
|
attribute :private_ip_address, :aliases => 'privateIpAddress'
|
@@ -30,7 +30,7 @@ module Fog
|
|
30
30
|
attribute :reason
|
31
31
|
attribute :root_device_name, :aliases => 'rootDeviceName'
|
32
32
|
attribute :root_device_type, :aliases => 'rootDeviceType'
|
33
|
-
attribute :state, :aliases => 'instanceState'
|
33
|
+
attribute :state, :aliases => 'instanceState', :squash => 'name'
|
34
34
|
attribute :state_reason, :aliases => 'stateReason'
|
35
35
|
attribute :subnet_id, :aliases => 'subnetId'
|
36
36
|
attribute :tags, :aliases => 'tagSet'
|
@@ -40,8 +40,8 @@ module Fog
|
|
40
40
|
attr_writer :private_key, :private_key_path, :public_key, :public_key_path, :username
|
41
41
|
|
42
42
|
def initialize(attributes={})
|
43
|
-
|
44
|
-
|
43
|
+
self.groups ||= ["default"] unless attributes[:subnet_id]
|
44
|
+
self.flavor_id ||= 'm1.small'
|
45
45
|
super
|
46
46
|
end
|
47
47
|
|
@@ -51,31 +51,22 @@ module Fog
|
|
51
51
|
connection.addresses(:server => self)
|
52
52
|
end
|
53
53
|
|
54
|
-
remove_method :availability_zone=
|
55
|
-
def availability_zone=(new_availability_zone)
|
56
|
-
if new_availability_zone.is_a?(Hash)
|
57
|
-
@availability_zone = new_availability_zone['availabilityZone']
|
58
|
-
else
|
59
|
-
@availability_zone = new_availability_zone
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
54
|
def console_output
|
64
55
|
requires :id
|
65
56
|
|
66
|
-
connection.get_console_output(
|
57
|
+
connection.get_console_output(id)
|
67
58
|
end
|
68
59
|
|
69
60
|
def destroy
|
70
61
|
requires :id
|
71
62
|
|
72
|
-
connection.terminate_instances(
|
63
|
+
connection.terminate_instances(id)
|
73
64
|
true
|
74
65
|
end
|
75
66
|
|
76
67
|
remove_method :flavor_id
|
77
68
|
def flavor_id
|
78
|
-
@flavor && @flavor.id ||
|
69
|
+
@flavor && @flavor.id || attributes[:flavor_id]
|
79
70
|
end
|
80
71
|
|
81
72
|
def flavor=(new_flavor)
|
@@ -83,26 +74,17 @@ module Fog
|
|
83
74
|
end
|
84
75
|
|
85
76
|
def flavor
|
86
|
-
@flavor ||= connection.flavors.all.detect {|flavor| flavor.id ==
|
77
|
+
@flavor ||= connection.flavors.all.detect {|flavor| flavor.id == flavor_id}
|
87
78
|
end
|
88
79
|
|
89
80
|
def key_pair
|
90
81
|
requires :key_name
|
91
82
|
|
92
|
-
connection.keypairs.all(
|
83
|
+
connection.keypairs.all(key_name).first
|
93
84
|
end
|
94
85
|
|
95
86
|
def key_pair=(new_keypair)
|
96
|
-
|
97
|
-
end
|
98
|
-
|
99
|
-
remove_method :monitoring=
|
100
|
-
def monitoring=(new_monitoring)
|
101
|
-
if new_monitoring.is_a?(Hash)
|
102
|
-
@monitoring = new_monitoring['state']
|
103
|
-
else
|
104
|
-
@monitoring = new_monitoring
|
105
|
-
end
|
87
|
+
key_name = new_keypair && new_keypair.name
|
106
88
|
end
|
107
89
|
|
108
90
|
def private_key_path
|
@@ -124,12 +106,12 @@ module Fog
|
|
124
106
|
end
|
125
107
|
|
126
108
|
def ready?
|
127
|
-
|
109
|
+
state == 'running'
|
128
110
|
end
|
129
111
|
|
130
112
|
def reboot
|
131
113
|
requires :id
|
132
|
-
connection.reboot_instances(
|
114
|
+
connection.reboot_instances(id)
|
133
115
|
true
|
134
116
|
end
|
135
117
|
|
@@ -191,13 +173,13 @@ module Fog
|
|
191
173
|
|
192
174
|
def start
|
193
175
|
requires :id
|
194
|
-
connection.start_instances(
|
176
|
+
connection.start_instances(id)
|
195
177
|
true
|
196
178
|
end
|
197
179
|
|
198
180
|
def stop
|
199
181
|
requires :id
|
200
|
-
connection.stop_instances(
|
182
|
+
connection.stop_instances(id)
|
201
183
|
true
|
202
184
|
end
|
203
185
|
|
@@ -210,17 +192,6 @@ module Fog
|
|
210
192
|
connection.volumes(:server => self)
|
211
193
|
end
|
212
194
|
|
213
|
-
private
|
214
|
-
|
215
|
-
remove_method :state=
|
216
|
-
def state=(new_state)
|
217
|
-
if new_state.is_a?(Hash)
|
218
|
-
@state = new_state['name']
|
219
|
-
else
|
220
|
-
@state = new_state
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
195
|
end
|
225
196
|
|
226
197
|
end
|
@@ -9,21 +9,19 @@ module Fog
|
|
9
9
|
|
10
10
|
attribute :filters
|
11
11
|
|
12
|
-
attribute :server_id
|
13
|
-
|
14
12
|
model Fog::AWS::Compute::Server
|
15
13
|
|
16
14
|
def initialize(attributes)
|
17
|
-
|
15
|
+
self.filters ||= {}
|
18
16
|
super
|
19
17
|
end
|
20
18
|
|
21
|
-
def all(filters =
|
19
|
+
def all(filters = self.filters)
|
22
20
|
unless filters.is_a?(Hash)
|
23
21
|
Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('instance-id' => []) instead[/] [light_black](#{caller.first})[/]")
|
24
22
|
filters = {'instance-id' => [*filters]}
|
25
23
|
end
|
26
|
-
|
24
|
+
self.filters = filters
|
27
25
|
data = connection.describe_instances(filters).body
|
28
26
|
load(
|
29
27
|
data['reservationSet'].map do |reservation|
|
@@ -22,7 +22,7 @@ module Fog
|
|
22
22
|
def destroy
|
23
23
|
requires :id
|
24
24
|
|
25
|
-
connection.delete_snapshot(
|
25
|
+
connection.delete_snapshot(id)
|
26
26
|
true
|
27
27
|
end
|
28
28
|
|
@@ -34,7 +34,7 @@ module Fog
|
|
34
34
|
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
|
35
35
|
requires :volume_id
|
36
36
|
|
37
|
-
data = connection.create_snapshot(
|
37
|
+
data = connection.create_snapshot(volume_id, description).body
|
38
38
|
new_attributes = data.reject {|key,value| key == 'requestId'}
|
39
39
|
merge_attributes(new_attributes)
|
40
40
|
true
|
@@ -42,13 +42,13 @@ module Fog
|
|
42
42
|
|
43
43
|
def volume
|
44
44
|
requires :id
|
45
|
-
connection.describe_volumes(
|
45
|
+
connection.describe_volumes(volume_id)
|
46
46
|
end
|
47
47
|
|
48
48
|
private
|
49
49
|
|
50
50
|
def volume=(new_volume)
|
51
|
-
|
51
|
+
self.volume_id = new_volume.volume_id
|
52
52
|
end
|
53
53
|
|
54
54
|
end
|