fog 0.0.22 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -2
- data/VERSION +1 -1
- data/fog.gemspec +18 -5
- data/lib/fog.rb +10 -0
- data/lib/fog/aws.rb +0 -8
- data/lib/fog/aws/models/ec2/address.rb +10 -2
- data/lib/fog/aws/models/ec2/addresses.rb +9 -6
- data/lib/fog/aws/models/ec2/instance.rb +4 -5
- data/lib/fog/aws/models/ec2/volume.rb +10 -2
- data/lib/fog/aws/models/ec2/volumes.rb +7 -6
- data/lib/fog/aws/models/s3/bucket.rb +0 -1
- data/lib/fog/aws/requests/ec2/run_instances.rb +3 -0
- data/lib/fog/rackspace.rb +0 -3
- data/lib/fog/rackspace/requests/servers/create_server.rb +9 -9
- data/lib/fog/rackspace/requests/servers/get_server_details.rb +9 -9
- data/lib/fog/rackspace/requests/servers/list_images.rb +1 -4
- data/lib/fog/rackspace/requests/servers/list_images_detail.rb +42 -0
- data/lib/fog/rackspace/requests/servers/{list_servers_details.rb → list_servers_detail.rb} +1 -1
- data/lib/fog/rackspace/requests/servers/reboot_server.rb +42 -0
- data/lib/fog/rackspace/requests/servers/update_server.rb +41 -0
- data/lib/fog/rackspace/servers.rb +4 -1
- data/spec/aws/models/ec2/instance_spec.rb +15 -2
- data/spec/aws/requests/ec2/run_instances_spec.rb +1 -0
- data/spec/rackspace/requests/servers/{list_servers_details_spec.rb → create_image_spec.rb} +3 -2
- data/spec/rackspace/requests/servers/create_server_spec.rb +23 -11
- data/spec/rackspace/requests/servers/delete_image.rb +12 -0
- data/spec/rackspace/requests/servers/delete_server_spec.rb +17 -1
- data/spec/rackspace/requests/servers/get_server_details_spec.rb +34 -1
- data/spec/rackspace/requests/servers/list_flavors_spec.rb +1 -0
- data/spec/rackspace/requests/servers/list_images_detail.rb +12 -0
- data/spec/rackspace/requests/servers/list_images_spec.rb +1 -0
- data/spec/rackspace/requests/servers/list_servers_detail_spec.rb +35 -0
- data/spec/rackspace/requests/servers/list_servers_spec.rb +15 -2
- data/spec/rackspace/requests/servers/reboot_server.rb +12 -0
- data/spec/rackspace/requests/servers/update_server.rb +12 -0
- metadata +18 -5
data/README.rdoc
CHANGED
@@ -10,9 +10,11 @@ fog helps you interact with cloud services. fog is a work in progress.
|
|
10
10
|
|
11
11
|
== Supports
|
12
12
|
|
13
|
-
* AWS EC2
|
13
|
+
* AWS EC2
|
14
14
|
* AWS S3
|
15
|
-
* AWS SimpleDB (
|
15
|
+
* AWS SimpleDB (no models yet)
|
16
|
+
* Rackspace Files (no models yet, just getting started on requests)
|
17
|
+
* Rackspace Servers (some requests, server model, just getting started)
|
16
18
|
|
17
19
|
== Synopsis
|
18
20
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.23
|
data/fog.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fog}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.23"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["geemus (Wesley Beary)"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-21}
|
13
13
|
s.default_executable = %q{fog}
|
14
14
|
s.description = %q{brings clouds to you}
|
15
15
|
s.email = %q{me@geemus.com}
|
@@ -149,8 +149,11 @@ Gem::Specification.new do |s|
|
|
149
149
|
"lib/fog/rackspace/requests/servers/get_server_details.rb",
|
150
150
|
"lib/fog/rackspace/requests/servers/list_flavors.rb",
|
151
151
|
"lib/fog/rackspace/requests/servers/list_images.rb",
|
152
|
+
"lib/fog/rackspace/requests/servers/list_images_detail.rb",
|
152
153
|
"lib/fog/rackspace/requests/servers/list_servers.rb",
|
153
|
-
"lib/fog/rackspace/requests/servers/
|
154
|
+
"lib/fog/rackspace/requests/servers/list_servers_detail.rb",
|
155
|
+
"lib/fog/rackspace/requests/servers/reboot_server.rb",
|
156
|
+
"lib/fog/rackspace/requests/servers/update_server.rb",
|
154
157
|
"lib/fog/rackspace/servers.rb",
|
155
158
|
"lib/fog/response.rb",
|
156
159
|
"spec/aws/models/ec2/address_spec.rb",
|
@@ -223,13 +226,18 @@ Gem::Specification.new do |s|
|
|
223
226
|
"spec/lorem.txt",
|
224
227
|
"spec/rackspace/requests/files/get_containers_spec.rb",
|
225
228
|
"spec/rackspace/requests/files/head_containers_spec.rb",
|
229
|
+
"spec/rackspace/requests/servers/create_image_spec.rb",
|
226
230
|
"spec/rackspace/requests/servers/create_server_spec.rb",
|
231
|
+
"spec/rackspace/requests/servers/delete_image.rb",
|
227
232
|
"spec/rackspace/requests/servers/delete_server_spec.rb",
|
228
233
|
"spec/rackspace/requests/servers/get_server_details_spec.rb",
|
229
234
|
"spec/rackspace/requests/servers/list_flavors_spec.rb",
|
235
|
+
"spec/rackspace/requests/servers/list_images_detail.rb",
|
230
236
|
"spec/rackspace/requests/servers/list_images_spec.rb",
|
231
|
-
"spec/rackspace/requests/servers/
|
237
|
+
"spec/rackspace/requests/servers/list_servers_detail_spec.rb",
|
232
238
|
"spec/rackspace/requests/servers/list_servers_spec.rb",
|
239
|
+
"spec/rackspace/requests/servers/reboot_server.rb",
|
240
|
+
"spec/rackspace/requests/servers/update_server.rb",
|
233
241
|
"spec/spec.opts",
|
234
242
|
"spec/spec_helper.rb"
|
235
243
|
]
|
@@ -309,13 +317,18 @@ Gem::Specification.new do |s|
|
|
309
317
|
"spec/aws/requests/simpledb/select_spec.rb",
|
310
318
|
"spec/rackspace/requests/files/get_containers_spec.rb",
|
311
319
|
"spec/rackspace/requests/files/head_containers_spec.rb",
|
320
|
+
"spec/rackspace/requests/servers/create_image_spec.rb",
|
312
321
|
"spec/rackspace/requests/servers/create_server_spec.rb",
|
322
|
+
"spec/rackspace/requests/servers/delete_image.rb",
|
313
323
|
"spec/rackspace/requests/servers/delete_server_spec.rb",
|
314
324
|
"spec/rackspace/requests/servers/get_server_details_spec.rb",
|
315
325
|
"spec/rackspace/requests/servers/list_flavors_spec.rb",
|
326
|
+
"spec/rackspace/requests/servers/list_images_detail.rb",
|
316
327
|
"spec/rackspace/requests/servers/list_images_spec.rb",
|
317
|
-
"spec/rackspace/requests/servers/
|
328
|
+
"spec/rackspace/requests/servers/list_servers_detail_spec.rb",
|
318
329
|
"spec/rackspace/requests/servers/list_servers_spec.rb",
|
330
|
+
"spec/rackspace/requests/servers/reboot_server.rb",
|
331
|
+
"spec/rackspace/requests/servers/update_server.rb",
|
319
332
|
"spec/spec_helper.rb"
|
320
333
|
]
|
321
334
|
|
data/lib/fog.rb
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'base64'
|
4
|
+
require 'cgi'
|
5
|
+
require 'digest/md5'
|
6
|
+
require 'hmac-sha1'
|
7
|
+
require 'hmac-sha2'
|
8
|
+
require 'json'
|
9
|
+
require 'mime/types'
|
10
|
+
|
1
11
|
__DIR__ = File.dirname(__FILE__)
|
2
12
|
|
3
13
|
$LOAD_PATH.unshift __DIR__ unless
|
data/lib/fog/aws.rb
CHANGED
@@ -24,8 +24,13 @@ module Fog
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def instance=(new_instance)
|
27
|
-
|
28
|
-
|
27
|
+
if !@public_ip
|
28
|
+
@instance = new_instance
|
29
|
+
elsif new_instance
|
30
|
+
@instance = nil
|
31
|
+
@instance_id = new_instance.instance_id
|
32
|
+
connection.associate_address(@instance_id, @public_ip)
|
33
|
+
end
|
29
34
|
end
|
30
35
|
|
31
36
|
def reload
|
@@ -36,6 +41,9 @@ module Fog
|
|
36
41
|
def save
|
37
42
|
data = connection.allocate_address
|
38
43
|
@public_ip = data.body['publicIp']
|
44
|
+
if @instance
|
45
|
+
instance = @instance
|
46
|
+
end
|
39
47
|
true
|
40
48
|
end
|
41
49
|
|
@@ -2,14 +2,16 @@ module Fog
|
|
2
2
|
module AWS
|
3
3
|
class EC2
|
4
4
|
|
5
|
-
def addresses
|
6
|
-
Fog::AWS::EC2::Addresses.new(
|
5
|
+
def addresses(attributes = {})
|
6
|
+
Fog::AWS::EC2::Addresses.new({
|
7
|
+
:connection => self
|
8
|
+
}.merge!(attributes))
|
7
9
|
end
|
8
10
|
|
9
11
|
class Addresses < Fog::Collection
|
10
12
|
|
11
13
|
attribute :public_ip
|
12
|
-
attribute :
|
14
|
+
attribute :instance
|
13
15
|
|
14
16
|
def initialize(attributes)
|
15
17
|
@public_ip ||= []
|
@@ -28,8 +30,8 @@ module Fog
|
|
28
30
|
:connection => connection
|
29
31
|
}.merge!(address))
|
30
32
|
end
|
31
|
-
if
|
32
|
-
addresses = addresses.select {|address| address.instance_id ==
|
33
|
+
if instance
|
34
|
+
addresses = addresses.select {|address| address.instance_id == instance.id}
|
33
35
|
end
|
34
36
|
addresses
|
35
37
|
end
|
@@ -49,7 +51,8 @@ module Fog
|
|
49
51
|
def new
|
50
52
|
Fog::AWS::EC2::Address.new(
|
51
53
|
:addresses => self,
|
52
|
-
:connection => connection
|
54
|
+
:connection => connection,
|
55
|
+
:instance => instance
|
53
56
|
)
|
54
57
|
end
|
55
58
|
|
@@ -16,15 +16,14 @@ module Fog
|
|
16
16
|
attribute :key_name, 'keyName'
|
17
17
|
attribute :launch_time, 'launchTime'
|
18
18
|
attribute :monitoring
|
19
|
-
attribute :placement
|
20
19
|
attribute :product_codes, 'productCodes'
|
21
20
|
attribute :private_dns_name, 'privateDnsName'
|
22
21
|
attribute :ramdisk_id, 'ramdiskId'
|
23
22
|
attribute :reason
|
24
23
|
attribute :user_data
|
25
24
|
|
26
|
-
def
|
27
|
-
connection.addresses(:
|
25
|
+
def addresses
|
26
|
+
connection.addresses(:instance => self)
|
28
27
|
end
|
29
28
|
|
30
29
|
def destroy
|
@@ -82,7 +81,7 @@ module Fog
|
|
82
81
|
options['groupId'] = @group_id
|
83
82
|
end
|
84
83
|
if @instance_type
|
85
|
-
options['
|
84
|
+
options['InstanceType'] = @instance_type
|
86
85
|
end
|
87
86
|
if @kernel_id
|
88
87
|
options['KernelId'] = @kernel_id
|
@@ -105,7 +104,7 @@ module Fog
|
|
105
104
|
end
|
106
105
|
|
107
106
|
def volumes
|
108
|
-
connection.volumes(:
|
107
|
+
connection.volumes(:instance => self)
|
109
108
|
end
|
110
109
|
|
111
110
|
private
|
@@ -27,8 +27,13 @@ module Fog
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def instance=(new_instance)
|
30
|
-
|
31
|
-
|
30
|
+
if !@volume_id
|
31
|
+
@instance = new_instance
|
32
|
+
elsif new_instance
|
33
|
+
@instance = nil
|
34
|
+
@instance_id = new_instance.instance_id
|
35
|
+
connection.attach_volume(@instance_id, @volume_id, @device)
|
36
|
+
end
|
32
37
|
end
|
33
38
|
|
34
39
|
def reload
|
@@ -40,6 +45,9 @@ module Fog
|
|
40
45
|
data = connection.create_volume(@availability_zone, @size, @snapshot_id).body
|
41
46
|
new_attributes = data.reject {|key,value| key == 'requestId'}
|
42
47
|
merge_attributes(new_attributes)
|
48
|
+
if @instance
|
49
|
+
instance = @instance
|
50
|
+
end
|
43
51
|
true
|
44
52
|
end
|
45
53
|
|
@@ -11,7 +11,7 @@ module Fog
|
|
11
11
|
class Volumes < Fog::Collection
|
12
12
|
|
13
13
|
attribute :volume_id
|
14
|
-
attribute :
|
14
|
+
attribute :instance
|
15
15
|
|
16
16
|
def initialize(attributes)
|
17
17
|
@volume_id ||= []
|
@@ -30,8 +30,8 @@ module Fog
|
|
30
30
|
:volumes => self
|
31
31
|
}.merge!(volume))
|
32
32
|
end
|
33
|
-
if
|
34
|
-
volumes = volumes.select {|volume| volume.instance_id ==
|
33
|
+
if instance
|
34
|
+
volumes = volumes.select {|volume| volume.instance_id == instance.id}
|
35
35
|
end
|
36
36
|
volumes
|
37
37
|
end
|
@@ -49,10 +49,11 @@ module Fog
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def new(attributes = {})
|
52
|
-
Fog::AWS::EC2::Volume.new(
|
52
|
+
volume = Fog::AWS::EC2::Volume.new(
|
53
53
|
attributes.merge!(
|
54
|
-
:connection
|
55
|
-
:
|
54
|
+
:connection => connection,
|
55
|
+
:instance => instance,
|
56
|
+
:volumes => self
|
56
57
|
)
|
57
58
|
)
|
58
59
|
end
|
@@ -64,6 +64,9 @@ unless Fog.mocking?
|
|
64
64
|
# * 'requestId'<~String> - Id of request
|
65
65
|
# * 'reservationId'<~String> - Id of reservation
|
66
66
|
def run_instances(image_id, min_count, max_count, options = {})
|
67
|
+
if options['UserData']
|
68
|
+
options['UserData'] = Base64.encode64(options['UserData'])
|
69
|
+
end
|
67
70
|
request({
|
68
71
|
'Action' => 'RunInstances',
|
69
72
|
'ImageId' => image_id,
|
data/lib/fog/rackspace.rb
CHANGED
@@ -21,19 +21,19 @@ unless Fog.mocking?
|
|
21
21
|
# ==== Returns
|
22
22
|
# * response<~Fog::AWS::Response>:
|
23
23
|
# * body<~Hash>:
|
24
|
-
# * '
|
25
|
-
# * 'adminPass'<~String> - Admin password for server
|
26
|
-
# * 'id'<~Integer> - Id of server
|
27
|
-
# * 'name<~String> - Name of server
|
28
|
-
# * 'imageId'<~Integer> - Id of image used to boot server
|
29
|
-
# * 'flavorId'<~Integer> - Id of servers current flavor
|
30
|
-
# * 'hostId'<~String>
|
31
|
-
# * 'status'<~String> - Current server status
|
32
|
-
# * 'progress'<~Integer> - Progress through current status
|
24
|
+
# * 'server'<~Hash>:
|
33
25
|
# * 'addresses'<~Hash>:
|
34
26
|
# * 'public'<~Array> - public address strings
|
35
27
|
# * 'private'<~Array> - private address strings
|
28
|
+
# * 'adminPass'<~String> - Admin password for server
|
29
|
+
# * 'flavorId'<~Integer> - Id of servers current flavor
|
30
|
+
# * 'hostId'<~String>
|
31
|
+
# * 'id'<~Integer> - Id of server
|
32
|
+
# * 'imageId'<~Integer> - Id of image used to boot server
|
36
33
|
# * 'metadata'<~Hash> - metadata
|
34
|
+
# * 'name<~String> - Name of server
|
35
|
+
# * 'progress'<~Integer> - Progress through current status
|
36
|
+
# * 'status'<~String> - Current server status
|
37
37
|
def create_server(flavor_id, image_id, options = {})
|
38
38
|
data = {
|
39
39
|
'server' => {
|
@@ -4,23 +4,23 @@ unless Fog.mocking?
|
|
4
4
|
module Rackspace
|
5
5
|
class Servers
|
6
6
|
|
7
|
-
#
|
7
|
+
# Get details about a server
|
8
8
|
#
|
9
9
|
# ==== Returns
|
10
10
|
# * response<~Fog::AWS::Response>:
|
11
11
|
# * body<~Hash>:
|
12
|
-
# * '
|
13
|
-
# * 'id'<~Integer> - Id of server
|
14
|
-
# * 'name<~String> - Name of server
|
15
|
-
# * 'imageId'<~Integer> - Id of image used to boot server
|
16
|
-
# * 'flavorId'<~Integer> - Id of servers current flavor
|
17
|
-
# * 'hostId'<~String>
|
18
|
-
# * 'status'<~String> - Current server status
|
19
|
-
# * 'progress'<~Integer> - Progress through current status
|
12
|
+
# * 'server'<~Hash>:
|
20
13
|
# * 'addresses'<~Hash>:
|
21
14
|
# * 'public'<~Array> - public address strings
|
22
15
|
# * 'private'<~Array> - private address strings
|
16
|
+
# * 'flavorId'<~Integer> - Id of servers current flavor
|
17
|
+
# * 'hostId'<~String>
|
18
|
+
# * 'id'<~Integer> - Id of server
|
19
|
+
# * 'imageId'<~Integer> - Id of image used to boot server
|
23
20
|
# * 'metadata'<~Hash> - metadata
|
21
|
+
# * 'name<~String> - Name of server
|
22
|
+
# * 'progress'<~Integer> - Progress through current status
|
23
|
+
# * 'status'<~String> - Current server status
|
24
24
|
def get_server_details(id)
|
25
25
|
request(
|
26
26
|
:expects => 200,
|
@@ -11,12 +11,9 @@ unless Fog.mocking?
|
|
11
11
|
# * body<~Hash>:
|
12
12
|
# * 'id'<~Integer> - Id of the image
|
13
13
|
# * 'name'<~String> - Name of the image
|
14
|
-
# * 'updated'<~String> - Last update timestamp for image
|
15
|
-
# * 'created'<~String> - Creation timestamp for image
|
16
|
-
# * 'status'<~String> - Status of image
|
17
14
|
def list_images
|
18
15
|
request(
|
19
|
-
:expects => 200,
|
16
|
+
:expects => [200, 203],
|
20
17
|
:method => 'GET',
|
21
18
|
:path => 'images.json'
|
22
19
|
)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
unless Fog.mocking?
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Rackspace
|
5
|
+
class Servers
|
6
|
+
|
7
|
+
# List all images
|
8
|
+
#
|
9
|
+
# ==== Returns
|
10
|
+
# * response<~Fog::AWS::Response>:
|
11
|
+
# * body<~Hash>:
|
12
|
+
# * 'id'<~Integer> - Id of the image
|
13
|
+
# * 'name'<~String> - Name of the image
|
14
|
+
# * 'updated'<~String> - Last update timestamp for image
|
15
|
+
# * 'created'<~String> - Creation timestamp for image
|
16
|
+
# * 'status'<~String> - Status of image
|
17
|
+
def list_images_detail
|
18
|
+
request(
|
19
|
+
:expects => [200, 203],
|
20
|
+
:method => 'GET',
|
21
|
+
:path => 'images/detail.json'
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
else
|
30
|
+
|
31
|
+
module Fog
|
32
|
+
module Rackspace
|
33
|
+
class Servers
|
34
|
+
|
35
|
+
def list_images
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -21,7 +21,7 @@ unless Fog.mocking?
|
|
21
21
|
# * 'public'<~Array> - public address strings
|
22
22
|
# * 'private'<~Array> - private address strings
|
23
23
|
# * 'metadata'<~Hash> - metadata
|
24
|
-
def
|
24
|
+
def list_servers_detail
|
25
25
|
request(
|
26
26
|
:expects => [200, 203],
|
27
27
|
:method => 'GET',
|
@@ -0,0 +1,42 @@
|
|
1
|
+
unless Fog.mocking?
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Rackspace
|
5
|
+
class Servers
|
6
|
+
|
7
|
+
# Reboot an existing server
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * server_id<~Integer> - Id of server to reboot
|
11
|
+
# * type<~String> - Type of reboot, must be in ['HARD', 'SOFT']
|
12
|
+
#
|
13
|
+
def reboot_server(server_id, type)
|
14
|
+
data = {
|
15
|
+
'reboot' => { 'type' => type }
|
16
|
+
}
|
17
|
+
request(
|
18
|
+
:body => data.to_json,
|
19
|
+
:expects => 202,
|
20
|
+
:method => 'POST',
|
21
|
+
:path => "servers/#{id}"
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
else
|
30
|
+
|
31
|
+
module Fog
|
32
|
+
module Rackspace
|
33
|
+
class Servers
|
34
|
+
|
35
|
+
def update_server
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
unless Fog.mocking?
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Rackspace
|
5
|
+
class Servers
|
6
|
+
|
7
|
+
# Update an existing server
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# # server_id<~Integer> - Id of server to update
|
11
|
+
# * options<~Hash>:
|
12
|
+
# * name<~String> - New name for server
|
13
|
+
# * adminPass<~String> - New admin password for server
|
14
|
+
#
|
15
|
+
def update_server(server_id, options = {})
|
16
|
+
request(
|
17
|
+
:body => options.to_json,
|
18
|
+
:expects => 204,
|
19
|
+
:method => 'PUT',
|
20
|
+
:path => "servers/#{id}"
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
else
|
29
|
+
|
30
|
+
module Fog
|
31
|
+
module Rackspace
|
32
|
+
class Servers
|
33
|
+
|
34
|
+
def update_server
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -13,8 +13,11 @@ module Fog
|
|
13
13
|
load "fog/rackspace/requests/servers/get_server_details.rb"
|
14
14
|
load "fog/rackspace/requests/servers/list_flavors.rb"
|
15
15
|
load "fog/rackspace/requests/servers/list_images.rb"
|
16
|
+
load "fog/rackspace/requests/servers/list_images_detail.rb"
|
16
17
|
load "fog/rackspace/requests/servers/list_servers.rb"
|
17
|
-
load "fog/rackspace/requests/servers/
|
18
|
+
load "fog/rackspace/requests/servers/list_servers_detail.rb"
|
19
|
+
load "fog/rackspace/requests/servers/reboot_server.rb"
|
20
|
+
load "fog/rackspace/requests/servers/update_server.rb"
|
18
21
|
end
|
19
22
|
|
20
23
|
def initialize(options={})
|
@@ -39,8 +39,17 @@ describe 'Fog::AWS::EC2::Instance' do
|
|
39
39
|
|
40
40
|
end
|
41
41
|
|
42
|
-
describe "#
|
43
|
-
|
42
|
+
describe "#addresses" do
|
43
|
+
|
44
|
+
it "should return a Fog::AWS::EC2::Addresses" do
|
45
|
+
instance = ec2.instances.new
|
46
|
+
instance.addresses.should be_a(Fog::AWS::EC2::Addresses)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should not associate the address to a not yet saved instance"
|
50
|
+
it "should associate the address after saving a new instance"
|
51
|
+
it "should associate the address to an existing instance"
|
52
|
+
|
44
53
|
end
|
45
54
|
|
46
55
|
describe "#destroy" do
|
@@ -132,6 +141,10 @@ describe 'Fog::AWS::EC2::Instance' do
|
|
132
141
|
instance.volumes.should be_a(Fog::AWS::EC2::Volumes)
|
133
142
|
end
|
134
143
|
|
144
|
+
it "should not attach the volume to a not yet saved instance"
|
145
|
+
it "should attach the volume after saving a new instance"
|
146
|
+
it "should attach the volume to an existing instance"
|
147
|
+
|
135
148
|
end
|
136
149
|
|
137
150
|
end
|
@@ -8,6 +8,7 @@ describe 'EC2.run_instances' do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should return proper attributes" do
|
11
|
+
# ami-5ee70037 = gentoo
|
11
12
|
actual = ec2.run_instances('ami-5ee70037', 1, 1)
|
12
13
|
@instance_id = actual.body['instancesSet'].first['instanceId']
|
13
14
|
actual.body['groupSet'].should be_an(Array)
|
@@ -1,10 +1,11 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
2
|
|
3
|
-
describe 'Rackspace::Servers.
|
3
|
+
describe 'Rackspace::Servers.create_image' do
|
4
4
|
describe 'success' do
|
5
5
|
|
6
6
|
it "should return proper attributes" do
|
7
|
-
|
7
|
+
pending
|
8
|
+
p servers.create_image(id)
|
8
9
|
end
|
9
10
|
|
10
11
|
end
|
@@ -3,18 +3,30 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe 'Rackspace::Servers.create_server' do
|
4
4
|
describe 'success' do
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
data = servers.create_server(1, 3)
|
10
|
-
p data
|
11
|
-
while true do
|
12
|
-
sleep(1)
|
13
|
-
details = servers.list_servers_details.body
|
14
|
-
p details['servers'].first['progress']
|
15
|
-
break if details['servers'].first['status'] == 'ACTIVE'
|
6
|
+
after(:each) do
|
7
|
+
eventually(128) do
|
8
|
+
servers.delete_server(@server_id)
|
16
9
|
end
|
17
|
-
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return proper attributes" do
|
13
|
+
# flavor 1 = 256, image 3 = gentoo 2008.0
|
14
|
+
actual = servers.create_server(1, 3).body['server']
|
15
|
+
@server_id = actual['id']
|
16
|
+
actual['addresses'].should be_a(Hash)
|
17
|
+
actual['addresses']['private'].should be_an(Array)
|
18
|
+
actual['addresses']['private'].first.should be_a(String)
|
19
|
+
actual['addresses']['public'].should be_an(Array)
|
20
|
+
actual['addresses']['public'].first.should be_a(String)
|
21
|
+
actual['adminPass'].should be_a(String)
|
22
|
+
actual['flavorId'].should be_an(Integer)
|
23
|
+
actual['hostId'].should be_a(String)
|
24
|
+
actual['id'].should be_an(Integer)
|
25
|
+
actual['imageId'].should be_an(Integer)
|
26
|
+
actual['metadata'].should be_a(Hash)
|
27
|
+
actual['name'].should be_a(String)
|
28
|
+
actual['progress'].should be_an(Integer)
|
29
|
+
actual['status'].should be_a(String)
|
18
30
|
end
|
19
31
|
|
20
32
|
end
|
@@ -3,8 +3,24 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe 'Rackspace::Servers.delete_server' do
|
4
4
|
describe 'success' do
|
5
5
|
|
6
|
+
before(:each) do
|
7
|
+
# flavor 1 = 256, image 3 = gentoo 2008.0
|
8
|
+
@server_id = servers.create_server(1, 3).body['server']['id']
|
9
|
+
end
|
10
|
+
|
6
11
|
it "should return proper attributes" do
|
7
|
-
|
12
|
+
eventually(128) do
|
13
|
+
servers.delete_server(@server_id)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
describe 'failure' do
|
19
|
+
|
20
|
+
it "should raise a NotFound error if the server does not exist" do
|
21
|
+
lambda {
|
22
|
+
servers.delete_server(0)
|
23
|
+
}.should raise_error(Fog::Errors::NotFound)
|
8
24
|
end
|
9
25
|
|
10
26
|
end
|
@@ -3,8 +3,41 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe 'Rackspace::Servers.get_server_details' do
|
4
4
|
describe 'success' do
|
5
5
|
|
6
|
+
before(:each) do
|
7
|
+
# flavor 1 = 256, image 3 = gentoo 2008.0
|
8
|
+
@server_id = servers.create_server(1, 3).body['server']['id']
|
9
|
+
end
|
10
|
+
|
11
|
+
after(:each) do
|
12
|
+
eventually(128) do
|
13
|
+
servers.delete_server(@server_id)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
6
17
|
it "should return proper attributes" do
|
7
|
-
|
18
|
+
actual = servers.get_server_details(@server_id).body['server']
|
19
|
+
actual['addresses'].should be_a(Hash)
|
20
|
+
actual['addresses']['private'].should be_an(Array)
|
21
|
+
actual['addresses']['private'].first.should be_a(String)
|
22
|
+
actual['addresses']['public'].should be_an(Array)
|
23
|
+
actual['addresses']['public'].first.should be_a(String)
|
24
|
+
actual['flavorId'].should be_an(Integer)
|
25
|
+
actual['hostId'].should be_a(String)
|
26
|
+
actual['id'].should be_an(Integer)
|
27
|
+
actual['imageId'].should be_an(Integer)
|
28
|
+
actual['metadata'].should be_a(Hash)
|
29
|
+
actual['name'].should be_a(String)
|
30
|
+
actual['progress'].should be_an(Integer)
|
31
|
+
actual['status'].should be_a(String)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
describe 'failure' do
|
36
|
+
|
37
|
+
it "should raise a NotFound error if the server does not exist" do
|
38
|
+
lambda {
|
39
|
+
servers.get_server_details(0)
|
40
|
+
}.should raise_error(Fog::Errors::NotFound)
|
8
41
|
end
|
9
42
|
|
10
43
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
+
|
3
|
+
describe 'Rackspace::Servers.list_servers_detail' do
|
4
|
+
describe 'success' do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
# flavor 1 = 256, image 3 = gentoo 2008.0
|
8
|
+
@server_id = servers.create_server(1, 3).body['server']['id']
|
9
|
+
end
|
10
|
+
|
11
|
+
after(:each) do
|
12
|
+
eventually(128) do
|
13
|
+
servers.delete_server(@server_id)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should return proper attributes" do
|
18
|
+
actual = servers.list_servers_detail.body['servers'].first
|
19
|
+
actual['addresses'].should be_a(Hash)
|
20
|
+
actual['addresses']['private'].should be_an(Array)
|
21
|
+
actual['addresses']['private'].first.should be_a(String)
|
22
|
+
actual['addresses']['public'].should be_an(Array)
|
23
|
+
actual['addresses']['public'].first.should be_a(String)
|
24
|
+
actual['flavorId'].should be_an(Integer)
|
25
|
+
actual['hostId'].should be_a(String)
|
26
|
+
actual['id'].should be_an(Integer)
|
27
|
+
actual['imageId'].should be_an(Integer)
|
28
|
+
actual['metadata'].should be_a(Hash)
|
29
|
+
actual['name'].should be_a(String)
|
30
|
+
actual['progress'].should be_an(Integer)
|
31
|
+
actual['status'].should be_a(String)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -3,9 +3,22 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe 'Rackspace::Servers.list_servers' do
|
4
4
|
describe 'success' do
|
5
5
|
|
6
|
+
before(:each) do
|
7
|
+
# flavor 1 = 256, image 3 = gentoo 2008.0
|
8
|
+
@server_id = servers.create_server(1, 3).body['server']['id']
|
9
|
+
end
|
10
|
+
|
11
|
+
after(:each) do
|
12
|
+
eventually(128) do
|
13
|
+
servers.delete_server(@server_id)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
6
17
|
it "should return proper attributes" do
|
7
|
-
|
18
|
+
actual = servers.list_servers.body['servers'].first
|
19
|
+
actual['id'].should be_an(Integer)
|
20
|
+
actual['name'].should be_a(String)
|
8
21
|
end
|
9
22
|
|
10
23
|
end
|
11
|
-
end
|
24
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
+
|
3
|
+
describe 'Rackspace::Servers.update_server' do
|
4
|
+
describe 'success' do
|
5
|
+
|
6
|
+
it "should return proper attributes" do
|
7
|
+
pending
|
8
|
+
p servers.update_server(id, :name => 'foo', :adminPass => 'bar')
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- geemus (Wesley Beary)
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-21 00:00:00 -07:00
|
13
13
|
default_executable: fog
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -182,8 +182,11 @@ files:
|
|
182
182
|
- lib/fog/rackspace/requests/servers/get_server_details.rb
|
183
183
|
- lib/fog/rackspace/requests/servers/list_flavors.rb
|
184
184
|
- lib/fog/rackspace/requests/servers/list_images.rb
|
185
|
+
- lib/fog/rackspace/requests/servers/list_images_detail.rb
|
185
186
|
- lib/fog/rackspace/requests/servers/list_servers.rb
|
186
|
-
- lib/fog/rackspace/requests/servers/
|
187
|
+
- lib/fog/rackspace/requests/servers/list_servers_detail.rb
|
188
|
+
- lib/fog/rackspace/requests/servers/reboot_server.rb
|
189
|
+
- lib/fog/rackspace/requests/servers/update_server.rb
|
187
190
|
- lib/fog/rackspace/servers.rb
|
188
191
|
- lib/fog/response.rb
|
189
192
|
- spec/aws/models/ec2/address_spec.rb
|
@@ -256,13 +259,18 @@ files:
|
|
256
259
|
- spec/lorem.txt
|
257
260
|
- spec/rackspace/requests/files/get_containers_spec.rb
|
258
261
|
- spec/rackspace/requests/files/head_containers_spec.rb
|
262
|
+
- spec/rackspace/requests/servers/create_image_spec.rb
|
259
263
|
- spec/rackspace/requests/servers/create_server_spec.rb
|
264
|
+
- spec/rackspace/requests/servers/delete_image.rb
|
260
265
|
- spec/rackspace/requests/servers/delete_server_spec.rb
|
261
266
|
- spec/rackspace/requests/servers/get_server_details_spec.rb
|
262
267
|
- spec/rackspace/requests/servers/list_flavors_spec.rb
|
268
|
+
- spec/rackspace/requests/servers/list_images_detail.rb
|
263
269
|
- spec/rackspace/requests/servers/list_images_spec.rb
|
264
|
-
- spec/rackspace/requests/servers/
|
270
|
+
- spec/rackspace/requests/servers/list_servers_detail_spec.rb
|
265
271
|
- spec/rackspace/requests/servers/list_servers_spec.rb
|
272
|
+
- spec/rackspace/requests/servers/reboot_server.rb
|
273
|
+
- spec/rackspace/requests/servers/update_server.rb
|
266
274
|
- spec/spec.opts
|
267
275
|
- spec/spec_helper.rb
|
268
276
|
has_rdoc: true
|
@@ -363,11 +371,16 @@ test_files:
|
|
363
371
|
- spec/aws/requests/simpledb/select_spec.rb
|
364
372
|
- spec/rackspace/requests/files/get_containers_spec.rb
|
365
373
|
- spec/rackspace/requests/files/head_containers_spec.rb
|
374
|
+
- spec/rackspace/requests/servers/create_image_spec.rb
|
366
375
|
- spec/rackspace/requests/servers/create_server_spec.rb
|
376
|
+
- spec/rackspace/requests/servers/delete_image.rb
|
367
377
|
- spec/rackspace/requests/servers/delete_server_spec.rb
|
368
378
|
- spec/rackspace/requests/servers/get_server_details_spec.rb
|
369
379
|
- spec/rackspace/requests/servers/list_flavors_spec.rb
|
380
|
+
- spec/rackspace/requests/servers/list_images_detail.rb
|
370
381
|
- spec/rackspace/requests/servers/list_images_spec.rb
|
371
|
-
- spec/rackspace/requests/servers/
|
382
|
+
- spec/rackspace/requests/servers/list_servers_detail_spec.rb
|
372
383
|
- spec/rackspace/requests/servers/list_servers_spec.rb
|
384
|
+
- spec/rackspace/requests/servers/reboot_server.rb
|
385
|
+
- spec/rackspace/requests/servers/update_server.rb
|
373
386
|
- spec/spec_helper.rb
|