fog 0.0.31 → 0.0.32
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +0 -2
- data/Rakefile +12 -7
- data/VERSION +1 -1
- data/bin/fog +16 -18
- data/fog.gemspec +34 -8
- data/lib/fog.rb +11 -0
- data/lib/fog/aws/models/ec2/address.rb +4 -0
- data/lib/fog/aws/models/ec2/instance.rb +17 -0
- data/lib/fog/aws/models/ec2/key_pair.rb +4 -0
- data/lib/fog/aws/models/ec2/security_group.rb +8 -0
- data/lib/fog/aws/models/ec2/snapshot.rb +7 -1
- data/lib/fog/aws/models/ec2/volume.rb +9 -1
- data/lib/fog/aws/models/s3/bucket.rb +10 -0
- data/lib/fog/aws/models/s3/buckets.rb +10 -4
- data/lib/fog/aws/models/s3/object.rb +5 -0
- data/lib/fog/aws/requests/ec2/allocate_address.rb +1 -1
- data/lib/fog/aws/requests/ec2/associate_address.rb +2 -2
- data/lib/fog/aws/requests/ec2/attach_volume.rb +2 -2
- data/lib/fog/aws/requests/ec2/authorize_security_group_ingress.rb +1 -1
- data/lib/fog/aws/requests/ec2/create_key_pair.rb +2 -2
- data/lib/fog/aws/requests/ec2/create_security_group.rb +2 -2
- data/lib/fog/aws/requests/ec2/create_snapshot.rb +2 -2
- data/lib/fog/aws/requests/ec2/create_volume.rb +1 -1
- data/lib/fog/aws/requests/ec2/delete_key_pair.rb +1 -1
- data/lib/fog/aws/requests/ec2/delete_security_group.rb +2 -2
- data/lib/fog/aws/requests/ec2/delete_snapshot.rb +2 -2
- data/lib/fog/aws/requests/ec2/delete_volume.rb +2 -2
- data/lib/fog/aws/requests/ec2/describe_addresses.rb +2 -2
- data/lib/fog/aws/requests/ec2/describe_availability_zones.rb +1 -1
- data/lib/fog/aws/requests/ec2/describe_images.rb +1 -1
- data/lib/fog/aws/requests/ec2/describe_instances.rb +2 -2
- data/lib/fog/aws/requests/ec2/describe_key_pairs.rb +2 -2
- data/lib/fog/aws/requests/ec2/describe_regions.rb +1 -1
- data/lib/fog/aws/requests/ec2/describe_security_groups.rb +2 -2
- data/lib/fog/aws/requests/ec2/describe_snapshots.rb +2 -2
- data/lib/fog/aws/requests/ec2/describe_volumes.rb +2 -2
- data/lib/fog/aws/requests/ec2/detach_volume.rb +2 -2
- data/lib/fog/aws/requests/ec2/disassociate_address.rb +2 -2
- data/lib/fog/aws/requests/ec2/get_console_output.rb +2 -2
- data/lib/fog/aws/requests/ec2/reboot_instances.rb +2 -2
- data/lib/fog/aws/requests/ec2/release_address.rb +2 -2
- data/lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb +1 -1
- data/lib/fog/aws/requests/ec2/run_instances.rb +1 -1
- data/lib/fog/aws/requests/ec2/terminate_instances.rb +2 -2
- data/lib/fog/aws/requests/s3/copy_object.rb +2 -2
- data/lib/fog/aws/requests/s3/delete_bucket.rb +3 -3
- data/lib/fog/aws/requests/s3/delete_object.rb +8 -7
- data/lib/fog/aws/requests/s3/get_bucket.rb +2 -2
- data/lib/fog/aws/requests/s3/get_bucket_location.rb +2 -2
- data/lib/fog/aws/requests/s3/get_object.rb +2 -2
- data/lib/fog/aws/requests/s3/get_request_payment.rb +2 -2
- data/lib/fog/aws/requests/s3/get_service.rb +1 -1
- data/lib/fog/aws/requests/s3/put_bucket.rb +8 -6
- data/lib/fog/aws/requests/s3/put_object.rb +9 -9
- data/lib/fog/aws/requests/s3/put_request_payment.rb +2 -2
- data/lib/fog/aws/requests/simpledb/batch_put_attributes.rb +2 -2
- data/lib/fog/aws/requests/simpledb/create_domain.rb +1 -1
- data/lib/fog/aws/requests/simpledb/delete_attributes.rb +2 -2
- data/lib/fog/aws/requests/simpledb/delete_domain.rb +1 -1
- data/lib/fog/aws/requests/simpledb/domain_metadata.rb +2 -2
- data/lib/fog/aws/requests/simpledb/get_attributes.rb +2 -2
- data/lib/fog/aws/requests/simpledb/list_domains.rb +1 -1
- data/lib/fog/aws/s3.rb +1 -12
- data/lib/fog/collection.rb +16 -8
- data/lib/fog/model.rb +36 -14
- data/lib/fog/rackspace/models/servers/image.rb +40 -0
- data/lib/fog/rackspace/models/servers/images.rb +50 -0
- data/lib/fog/rackspace/models/servers/server.rb +18 -2
- data/lib/fog/rackspace/requests/servers/create_image.rb +18 -1
- data/lib/fog/rackspace/requests/servers/create_server.rb +5 -5
- data/lib/fog/rackspace/requests/servers/delete_image.rb +16 -1
- data/lib/fog/rackspace/requests/servers/delete_server.rb +4 -4
- data/lib/fog/rackspace/requests/servers/get_server_details.rb +2 -2
- data/lib/fog/rackspace/requests/servers/list_addresses.rb +2 -2
- data/lib/fog/rackspace/requests/servers/list_images.rb +10 -0
- data/lib/fog/rackspace/requests/servers/list_images_detail.rb +16 -1
- data/lib/fog/rackspace/requests/servers/list_private_addresses.rb +2 -2
- data/lib/fog/rackspace/requests/servers/list_public_addresses.rb +2 -2
- data/lib/fog/rackspace/requests/servers/list_servers.rb +1 -1
- data/lib/fog/rackspace/requests/servers/list_servers_detail.rb +2 -2
- data/lib/fog/rackspace/requests/servers/update_server.rb +2 -2
- data/lib/fog/rackspace/servers.rb +8 -2
- data/lib/fog/slicehost.rb +66 -0
- data/lib/fog/slicehost/parsers/create_slice.rb +29 -0
- data/lib/fog/slicehost/parsers/get_backups.rb +30 -0
- data/lib/fog/slicehost/parsers/get_flavors.rb +28 -0
- data/lib/fog/slicehost/parsers/get_images.rb +28 -0
- data/lib/fog/slicehost/parsers/get_slices.rb +33 -0
- data/lib/fog/slicehost/requests/create_slice.rb +50 -0
- data/lib/fog/slicehost/requests/delete_slice.rb +48 -0
- data/lib/fog/slicehost/requests/get_backups.rb +38 -0
- data/lib/fog/slicehost/requests/get_flavors.rb +38 -0
- data/lib/fog/slicehost/requests/get_images.rb +36 -0
- data/lib/fog/slicehost/requests/get_slices.rb +44 -0
- data/spec/aws/requests/s3/put_object_spec.rb +8 -0
- data/spec/rackspace/requests/servers/create_image_spec.rb +1 -1
- data/spec/rackspace/requests/servers/create_server_spec.rb +1 -1
- data/spec/rackspace/requests/servers/delete_image_spec.rb +7 -5
- data/spec/rackspace/requests/servers/delete_server_spec.rb +1 -1
- data/spec/rackspace/requests/servers/get_server_details_spec.rb +1 -1
- data/spec/rackspace/requests/servers/list_addresses_spec.rb +1 -1
- data/spec/rackspace/requests/servers/list_private_addresses_spec.rb +1 -1
- data/spec/rackspace/requests/servers/list_public_addresses_spec.rb +1 -1
- data/spec/rackspace/requests/servers/list_servers_detail_spec.rb +1 -1
- data/spec/rackspace/requests/servers/list_servers_spec.rb +1 -1
- data/spec/rackspace/requests/servers/reboot_server_spec.rb +1 -1
- data/spec/rackspace/requests/servers/update_server_spec.rb +1 -1
- data/spec/slicehost/requests/create_slice_spec.rb +29 -0
- data/spec/slicehost/requests/delete_slice_spec.rb +18 -0
- data/spec/slicehost/requests/get_backups_spec.rb +17 -0
- data/spec/slicehost/requests/get_flavors_spec.rb +17 -0
- data/spec/slicehost/requests/get_images_spec.rb +15 -0
- data/spec/slicehost/requests/get_slices_spec.rb +23 -0
- data/spec/spec_helper.rb +20 -22
- metadata +29 -4
- data/lib/fog/aws/models/s3/owner.rb +0 -18
@@ -0,0 +1,38 @@
|
|
1
|
+
unless Fog.mocking?
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
class Slicehost
|
5
|
+
|
6
|
+
# Get list of flavors
|
7
|
+
#
|
8
|
+
# ==== Returns
|
9
|
+
# * response<~Excon::Response>:
|
10
|
+
# * body<~Array>:
|
11
|
+
# * 'id'<~Integer> - Id of the flavor
|
12
|
+
# * 'name'<~String> - Name of the flavor
|
13
|
+
# * 'price'<~Integer> - Price in cents
|
14
|
+
# * 'ram'<~Integer> - Amount of ram for the flavor
|
15
|
+
def get_flavors
|
16
|
+
request(
|
17
|
+
:expects => 200,
|
18
|
+
:method => 'GET',
|
19
|
+
:parser => Fog::Parsers::Slicehost::GetFlavors.new,
|
20
|
+
:path => 'flavors.xml'
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
else
|
28
|
+
|
29
|
+
module Fog
|
30
|
+
class Slicehost
|
31
|
+
|
32
|
+
def get_flavors
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
unless Fog.mocking?
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
class Slicehost
|
5
|
+
|
6
|
+
# Get list of images
|
7
|
+
#
|
8
|
+
# ==== Returns
|
9
|
+
# * response<~Excon::Response>:
|
10
|
+
# * body<~Array>:
|
11
|
+
# * 'id'<~Integer> - Id of the image
|
12
|
+
# * 'name'<~String> - Name of the image
|
13
|
+
def get_images
|
14
|
+
request(
|
15
|
+
:expects => 200,
|
16
|
+
:method => 'GET',
|
17
|
+
:parser => Fog::Parsers::Slicehost::GetImages.new,
|
18
|
+
:path => 'images.xml'
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
else
|
26
|
+
|
27
|
+
module Fog
|
28
|
+
class Slicehost
|
29
|
+
|
30
|
+
def get_images
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
unless Fog.mocking?
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
class Slicehost
|
5
|
+
|
6
|
+
# Get list of slices
|
7
|
+
#
|
8
|
+
# ==== Returns
|
9
|
+
# * response<~Excon::Response>:
|
10
|
+
# * body<~Array>:
|
11
|
+
# * 'addresses'<~Array> - Ip addresses for the slice
|
12
|
+
# * 'backup-id'<~Integer> - Id of backup slice was booted from
|
13
|
+
# * 'bw-in'<~Float> - Incoming bandwidth total for current billing cycle, in Gigabytes
|
14
|
+
# * 'bw-out'<~Float> - Outgoing bandwidth total for current billing cycle, in Gigabytes
|
15
|
+
# * 'flavor_id'<~Integer> - Id of flavor slice was booted from
|
16
|
+
# * 'id'<~Integer> - Id of the slice
|
17
|
+
# * 'image-id'<~Integer> - Id of image slice was booted from
|
18
|
+
# * 'name'<~String> - Name of the slice
|
19
|
+
# * 'progress'<~Integer> - Progress of current action, in percentage
|
20
|
+
# * 'status'<~String> - Current status of the slice
|
21
|
+
def get_slices
|
22
|
+
request(
|
23
|
+
:expects => 200,
|
24
|
+
:method => 'GET',
|
25
|
+
:parser => Fog::Parsers::Slicehost::GetSlices.new,
|
26
|
+
:path => 'slices.xml'
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
else
|
34
|
+
|
35
|
+
module Fog
|
36
|
+
class Slicehost
|
37
|
+
|
38
|
+
def get_slices
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -31,5 +31,13 @@ describe 'S3.put_object' do
|
|
31
31
|
}.should raise_error(Excon::Errors::NotFound)
|
32
32
|
end
|
33
33
|
|
34
|
+
it 'should not raise an error if the object already exists' do
|
35
|
+
s3.put_bucket('fogputobject')
|
36
|
+
s3.put_object('fogputobject', 'fog_put_object', lorem_file)
|
37
|
+
s3.put_object('fogputobject', 'fog_put_object', lorem_file)
|
38
|
+
s3.delete_object('fogputobject', 'fog_put_object')
|
39
|
+
s3.delete_bucket('fogputobject')
|
40
|
+
end
|
41
|
+
|
34
42
|
end
|
35
43
|
end
|
@@ -5,7 +5,7 @@ describe 'Rackspace::Servers.create_image' do
|
|
5
5
|
|
6
6
|
before(:each) do
|
7
7
|
# flavor 1 = 256, image 3 = gentoo 2008.0
|
8
|
-
@server_id = servers.create_server(1, 3).body['server']['id']
|
8
|
+
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
9
9
|
end
|
10
10
|
|
11
11
|
after(:each) do
|
@@ -11,7 +11,7 @@ describe 'Rackspace::Servers.create_server' do
|
|
11
11
|
|
12
12
|
it "should return proper attributes" do
|
13
13
|
# flavor 1 = 256, image 3 = gentoo 2008.0
|
14
|
-
actual = servers.create_server(1, 3).body['server']
|
14
|
+
actual = servers.create_server(1, 3, 'name').body['server']
|
15
15
|
@server_id = actual['id']
|
16
16
|
actual['addresses'].should be_a(Hash)
|
17
17
|
actual['addresses']['private'].should be_an(Array)
|
@@ -5,8 +5,8 @@ describe 'Rackspace::Servers.delete_image' do
|
|
5
5
|
|
6
6
|
before(:each) do
|
7
7
|
# flavor 1 = 256, image 3 = gentoo 2008.0
|
8
|
-
@server_id = servers.create_server(1, 3).body['server']['id']
|
9
|
-
@image_id = servers.create_image(@server_id)
|
8
|
+
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
9
|
+
@image_id = servers.create_image(@server_id).body['image']['id']
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should return proper attributes" do
|
@@ -16,16 +16,18 @@ describe 'Rackspace::Servers.delete_image' do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should return proper attributes" do
|
19
|
-
|
19
|
+
eventually(128) do
|
20
|
+
servers.delete_image(@image_id)
|
21
|
+
end
|
20
22
|
end
|
21
23
|
|
22
24
|
end
|
23
25
|
describe 'failure' do
|
24
26
|
|
25
|
-
it "should raise a
|
27
|
+
it "should raise a BadRequest error if the image does not exist" do
|
26
28
|
lambda do
|
27
29
|
servers.delete_image(0)
|
28
|
-
end.should raise_error(Excon::Errors::
|
30
|
+
end.should raise_error(Excon::Errors::BadRequest)
|
29
31
|
end
|
30
32
|
|
31
33
|
end
|
@@ -5,7 +5,7 @@ describe 'Rackspace::Servers.delete_server' do
|
|
5
5
|
|
6
6
|
before(:each) do
|
7
7
|
# flavor 1 = 256, image 3 = gentoo 2008.0
|
8
|
-
@server_id = servers.create_server(1, 3).body['server']['id']
|
8
|
+
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should return proper attributes" do
|
@@ -5,7 +5,7 @@ describe 'Rackspace::Servers.get_server_details' do
|
|
5
5
|
|
6
6
|
before(:each) do
|
7
7
|
# flavor 1 = 256, image 3 = gentoo 2008.0
|
8
|
-
@server_id = servers.create_server(1, 3).body['server']['id']
|
8
|
+
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
9
9
|
end
|
10
10
|
|
11
11
|
after(:each) do
|
@@ -5,7 +5,7 @@ describe 'Rackspace::Servers.list_addresses' do
|
|
5
5
|
|
6
6
|
before(:each) do
|
7
7
|
# flavor 1 = 256, image 3 = gentoo 2008.0
|
8
|
-
@server_id = servers.create_server(1, 3).body['server']['id']
|
8
|
+
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
9
9
|
end
|
10
10
|
|
11
11
|
after(:each) do
|
@@ -5,7 +5,7 @@ describe 'Rackspace::Servers.list_private_addresses' do
|
|
5
5
|
|
6
6
|
before(:each) do
|
7
7
|
# flavor 1 = 256, image 3 = gentoo 2008.0
|
8
|
-
@server_id = servers.create_server(1, 3).body['server']['id']
|
8
|
+
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
9
9
|
end
|
10
10
|
|
11
11
|
after(:each) do
|
@@ -5,7 +5,7 @@ describe 'Rackspace::Servers.list_public_addresses' do
|
|
5
5
|
|
6
6
|
before(:each) do
|
7
7
|
# flavor 1 = 256, image 3 = gentoo 2008.0
|
8
|
-
@server_id = servers.create_server(1, 3).body['server']['id']
|
8
|
+
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
9
9
|
end
|
10
10
|
|
11
11
|
after(:each) do
|
@@ -5,7 +5,7 @@ describe 'Rackspace::Servers.list_servers_detail' do
|
|
5
5
|
|
6
6
|
before(:each) do
|
7
7
|
# flavor 1 = 256, image 3 = gentoo 2008.0
|
8
|
-
@server_id = servers.create_server(1, 3).body['server']['id']
|
8
|
+
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
9
9
|
end
|
10
10
|
|
11
11
|
after(:each) do
|
@@ -5,7 +5,7 @@ describe 'Rackspace::Servers.list_servers' do
|
|
5
5
|
|
6
6
|
before(:each) do
|
7
7
|
# flavor 1 = 256, image 3 = gentoo 2008.0
|
8
|
-
@server_id = servers.create_server(1, 3).body['server']['id']
|
8
|
+
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
9
9
|
end
|
10
10
|
|
11
11
|
after(:each) do
|
@@ -5,7 +5,7 @@ describe 'Rackspace::Servers.reboot_server' do
|
|
5
5
|
|
6
6
|
before(:each) do
|
7
7
|
# flavor 1 = 256, image 3 = gentoo 2008.0
|
8
|
-
@server_id = servers.create_server(1, 3).body['server']['id']
|
8
|
+
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
9
9
|
end
|
10
10
|
|
11
11
|
after(:each) do
|
@@ -5,7 +5,7 @@ describe 'Rackspace::Servers.update_server' do
|
|
5
5
|
|
6
6
|
before(:each) do
|
7
7
|
# flavor 1 = 256, image 3 = gentoo 2008.0
|
8
|
-
@server_id = servers.create_server(1, 3).body['server']['id']
|
8
|
+
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
9
9
|
end
|
10
10
|
|
11
11
|
after(:each) do
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe 'Slicehost.create_slice' do
|
4
|
+
describe 'success' do
|
5
|
+
|
6
|
+
after(:each) do
|
7
|
+
eventually(128) do
|
8
|
+
slicehost.delete_slice(@slice_id)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return proper attributes" do
|
13
|
+
# flavor_id 1: 256 ram, image_id 3: Gentoo 2008.0
|
14
|
+
actual = slicehost.create_slice(1, 3, 'fogslice').body
|
15
|
+
actual['addresses'].should be_a(Array)
|
16
|
+
# actual['backup-id'].should be_an(Integer)
|
17
|
+
actual['bw-in'].should be_an(Float)
|
18
|
+
actual['bw-out'].should be_an(Float)
|
19
|
+
actual['flavor-id'].should be_an(Integer)
|
20
|
+
actual['id'].should be_an(Integer)
|
21
|
+
actual['image-id'].should be_an(Integer)
|
22
|
+
actual['name'].should be_an(String)
|
23
|
+
actual['progress'].should be_an(Integer)
|
24
|
+
actual['root-password'].should be_a(String)
|
25
|
+
actual['status'].should be_an(String)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe 'Slicehost.delete_slice' do
|
4
|
+
describe 'success' do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
# flavor_id 1: 256 ram, image_id 3: Gentoo 2008.0
|
8
|
+
@slice_id = slicehost.create_slice(1, 3, 'fog_slice').body['id']
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return proper attributes" do
|
12
|
+
eventually(128) do
|
13
|
+
actual = slicehost.delete_slice(@slice_id)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe 'Slicehost.get_backups' do
|
4
|
+
describe 'success' do
|
5
|
+
|
6
|
+
it "should return proper attributes" do
|
7
|
+
actual = slicehost.get_backups.body
|
8
|
+
actual['backups'].should be_an(Array)
|
9
|
+
backup = actual['backups'].first
|
10
|
+
# backup['date'].should be_a(String)
|
11
|
+
# backup['id'].should be_an(Integer)
|
12
|
+
# backup['name'].should be_an(String)
|
13
|
+
# backup['slice-id'].should be_an(Integer)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe 'Slicehost.get_flavors' do
|
4
|
+
describe 'success' do
|
5
|
+
|
6
|
+
it "should return proper attributes" do
|
7
|
+
actual = slicehost.get_flavors.body
|
8
|
+
actual['flavors'].should be_an(Array)
|
9
|
+
flavor = actual['flavors'].first
|
10
|
+
flavor['id'].should be_an(Integer)
|
11
|
+
flavor['name'].should be_an(String)
|
12
|
+
flavor['price'].should be_a(Integer)
|
13
|
+
flavor['ram'].should be_an(Integer)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe 'Slicehost.get_images' do
|
4
|
+
describe 'success' do
|
5
|
+
|
6
|
+
it "should return proper attributes" do
|
7
|
+
actual = slicehost.get_images.body
|
8
|
+
actual['images'].should be_an(Array)
|
9
|
+
image = actual['images'].first
|
10
|
+
image['id'].should be_an(Integer)
|
11
|
+
image['name'].should be_a(String)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe 'Slicehost.get_slices' do
|
4
|
+
describe 'success' do
|
5
|
+
|
6
|
+
it "should return proper attributes" do
|
7
|
+
actual = slicehost.get_slices.body
|
8
|
+
actual['slices'].should be_an(Array)
|
9
|
+
slice = actual['slices'].first
|
10
|
+
# slice['addresses'].should be_a(Array)
|
11
|
+
# slice['backup-id'].should be_an(Integer)
|
12
|
+
# slice['bw-in'].should be_an(Integer)
|
13
|
+
# slice['bw-out'].should be_an(Integer)
|
14
|
+
# slice['flavor-id'].should be_an(Integer)
|
15
|
+
# slice['id'].should be_an(Integer)
|
16
|
+
# slice['image-id'].should be_an(Integer)
|
17
|
+
# slice['name'].should be_an(String)
|
18
|
+
# slice['progress'].should be_an(Integer)
|
19
|
+
# slice['status'].should be_an(String)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,54 +5,52 @@ current_directory = File.dirname(__FILE__)
|
|
5
5
|
require "#{current_directory}/../lib/fog"
|
6
6
|
# Fog.mock!
|
7
7
|
|
8
|
-
def credentials
|
9
|
-
@credentials ||= begin
|
10
|
-
credentials_path = File.expand_path('~/.fog')
|
11
|
-
credentials_data = File.open(credentials_path).read
|
12
|
-
YAML.load(credentials_data)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
8
|
def ec2
|
17
9
|
Fog::AWS::EC2.new(
|
18
|
-
:aws_access_key_id => credentials[:aws_access_key_id],
|
19
|
-
:aws_secret_access_key => credentials[:aws_secret_access_key]
|
10
|
+
:aws_access_key_id => Fog.credentials[:aws_access_key_id],
|
11
|
+
:aws_secret_access_key => Fog.credentials[:aws_secret_access_key]
|
20
12
|
)
|
21
13
|
end
|
22
14
|
|
23
15
|
def eu_s3
|
24
16
|
Fog::AWS::S3.new(
|
25
|
-
:aws_access_key_id => credentials[:aws_access_key_id],
|
26
|
-
:aws_secret_access_key => credentials[:aws_secret_access_key],
|
17
|
+
:aws_access_key_id => Fog.credentials[:aws_access_key_id],
|
18
|
+
:aws_secret_access_key => Fog.credentials[:aws_secret_access_key],
|
27
19
|
:host => 's3-external-3.amazonaws.com'
|
28
20
|
)
|
29
21
|
end
|
30
22
|
|
31
23
|
def files
|
32
24
|
Fog::Rackspace::Files.new(
|
33
|
-
:rackspace_api_key => credentials[:rackspace_api_key],
|
34
|
-
:rackspace_username => credentials[:rackspace_username]
|
25
|
+
:rackspace_api_key => Fog.credentials[:rackspace_api_key],
|
26
|
+
:rackspace_username => Fog.credentials[:rackspace_username]
|
35
27
|
)
|
36
28
|
end
|
37
29
|
|
38
30
|
def sdb
|
39
31
|
Fog::AWS::SimpleDB.new(
|
40
|
-
:aws_access_key_id => credentials[:aws_access_key_id],
|
41
|
-
:aws_secret_access_key => credentials[:aws_secret_access_key]
|
32
|
+
:aws_access_key_id => Fog.credentials[:aws_access_key_id],
|
33
|
+
:aws_secret_access_key => Fog.credentials[:aws_secret_access_key]
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
def s3
|
38
|
+
Fog::AWS::S3.new(
|
39
|
+
:aws_access_key_id => Fog.credentials[:aws_access_key_id],
|
40
|
+
:aws_secret_access_key => Fog.credentials[:aws_secret_access_key]
|
42
41
|
)
|
43
42
|
end
|
44
43
|
|
45
44
|
def servers
|
46
45
|
Fog::Rackspace::Servers.new(
|
47
|
-
:rackspace_api_key => credentials[:rackspace_api_key],
|
48
|
-
:rackspace_username => credentials[:rackspace_username]
|
46
|
+
:rackspace_api_key => Fog.credentials[:rackspace_api_key],
|
47
|
+
:rackspace_username => Fog.credentials[:rackspace_username]
|
49
48
|
)
|
50
49
|
end
|
51
50
|
|
52
|
-
def
|
53
|
-
Fog::
|
54
|
-
:
|
55
|
-
:aws_secret_access_key => credentials[:aws_secret_access_key]
|
51
|
+
def slicehost
|
52
|
+
Fog::Slicehost.new(
|
53
|
+
:password => Fog.credentials[:slicehost_password]
|
56
54
|
)
|
57
55
|
end
|
58
56
|
|