fog 0.0.59 → 0.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
- data/bin/fog +23 -17
- data/fog.gemspec +16 -23
- data/lib/fog/aws/models/s3/directories.rb +5 -3
- data/lib/fog/aws/models/s3/files.rb +1 -0
- data/lib/fog/aws/requests/s3/get_bucket.rb +1 -0
- data/lib/fog/collection.rb +4 -0
- data/lib/fog/model.rb +4 -0
- data/lib/fog/slicehost.rb +1 -1
- data/tests/slicehost/requests/create_slice_tests.rb +19 -0
- data/tests/slicehost/requests/delete_slice_tests.rb +28 -0
- data/tests/slicehost/requests/get_backups_tests.rb +14 -0
- data/tests/slicehost/requests/get_flavor_tests.rb +23 -0
- data/tests/slicehost/requests/get_flavors_tests.rb +10 -0
- data/tests/slicehost/requests/get_image_tests.rb +23 -0
- data/tests/slicehost/requests/get_images_tests.rb +10 -0
- data/tests/slicehost/requests/get_slice_tests.rb +33 -0
- data/tests/slicehost/requests/get_slices_tests.rb +10 -0
- data/tests/slicehost/requests/reboot_slice_tests.rb +34 -0
- data/tests/slicehost/slicehost_helper.rb +51 -0
- data/tests/test_helper.rb +43 -0
- data/tests/test_helper_tests.rb +39 -0
- metadata +16 -23
- data/spec/slicehost/requests/create_slice_spec.rb +0 -30
- data/spec/slicehost/requests/delete_slice_spec.rb +0 -18
- data/spec/slicehost/requests/get_backups_spec.rb +0 -17
- data/spec/slicehost/requests/get_flavor_spec.rb +0 -24
- data/spec/slicehost/requests/get_flavors_spec.rb +0 -17
- data/spec/slicehost/requests/get_image_spec.rb +0 -24
- data/spec/slicehost/requests/get_images_spec.rb +0 -15
- data/spec/slicehost/requests/get_slice_spec.rb +0 -41
- data/spec/slicehost/requests/get_slices_spec.rb +0 -34
- data/spec/slicehost/requests/reboot_slice_spec.rb +0 -41
data/VERSION.yml
CHANGED
data/bin/fog
CHANGED
@@ -16,22 +16,28 @@ require File.join(lib_dir, 'fog', 'rackspace', 'bin')
|
|
16
16
|
require File.join(lib_dir, 'fog', 'slicehost', 'bin')
|
17
17
|
require File.join(lib_dir, 'fog', 'terremark', 'bin')
|
18
18
|
|
19
|
-
ARGV.
|
20
|
-
|
21
|
-
@irb = IRB::Irb.new(nil)
|
22
|
-
IRB.conf[:MAIN_CONTEXT] = @irb.context
|
23
|
-
IRB.conf[:PROMPT][:FOG] = IRB.conf[:PROMPT][:SIMPLE].dup
|
24
|
-
IRB.conf[:PROMPT][:FOG][:RETURN] = "%s\n"
|
25
|
-
@irb.context.prompt_mode = :FOG
|
26
|
-
@irb.context.workspace = IRB::WorkSpace.new(binding)
|
27
|
-
|
28
|
-
services = Fog.services.map{|service| service.to_s}
|
29
|
-
available_services = if services.length > 1
|
30
|
-
services[0...-1].join(', ') << ' and ' << services[-1]
|
19
|
+
if ARGV.length > 1
|
20
|
+
p instance_eval(ARGV[1..-1].join(' ')).to_json
|
31
21
|
else
|
32
|
-
services.first
|
33
|
-
end
|
34
|
-
print "Welcome to fog interactive!\n"
|
35
|
-
print "Your '#{Fog.credential.to_s}' configuration provides access to #{available_services}.\n"
|
36
22
|
|
37
|
-
|
23
|
+
ARGV.clear # Avoid passing args to IRB
|
24
|
+
IRB.setup(nil)
|
25
|
+
@irb = IRB::Irb.new(nil)
|
26
|
+
IRB.conf[:MAIN_CONTEXT] = @irb.context
|
27
|
+
IRB.conf[:PROMPT][:FOG] = IRB.conf[:PROMPT][:SIMPLE].dup
|
28
|
+
IRB.conf[:PROMPT][:FOG][:RETURN] = "%s\n"
|
29
|
+
@irb.context.prompt_mode = :FOG
|
30
|
+
@irb.context.workspace = IRB::WorkSpace.new(binding)
|
31
|
+
|
32
|
+
services = Fog.services.map{|service| service.to_s}
|
33
|
+
available_services = if services.length > 1
|
34
|
+
services[0...-1].join(', ') << ' and ' << services[-1]
|
35
|
+
else
|
36
|
+
services.first
|
37
|
+
end
|
38
|
+
print "Welcome to fog interactive!\n"
|
39
|
+
print "Your '#{Fog.credential.to_s}' configuration provides access to #{available_services}.\n"
|
40
|
+
|
41
|
+
catch(:IRB_EXIT) { @irb.eval_input }
|
42
|
+
|
43
|
+
end
|
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.60"
|
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{2010-03-
|
12
|
+
s.date = %q{2010-03-28}
|
13
13
|
s.default_executable = %q{fog}
|
14
14
|
s.description = %q{brings clouds to you}
|
15
15
|
s.email = %q{geemus@gmail.com}
|
@@ -326,17 +326,20 @@ Gem::Specification.new do |s|
|
|
326
326
|
"spec/slicehost/models/flavors_spec.rb",
|
327
327
|
"spec/slicehost/models/server_spec.rb",
|
328
328
|
"spec/slicehost/models/servers_spec.rb",
|
329
|
-
"spec/
|
330
|
-
"
|
331
|
-
"
|
332
|
-
"
|
333
|
-
"
|
334
|
-
"
|
335
|
-
"
|
336
|
-
"
|
337
|
-
"
|
338
|
-
"
|
339
|
-
"
|
329
|
+
"spec/spec_helper.rb",
|
330
|
+
"tests/slicehost/requests/create_slice_tests.rb",
|
331
|
+
"tests/slicehost/requests/delete_slice_tests.rb",
|
332
|
+
"tests/slicehost/requests/get_backups_tests.rb",
|
333
|
+
"tests/slicehost/requests/get_flavor_tests.rb",
|
334
|
+
"tests/slicehost/requests/get_flavors_tests.rb",
|
335
|
+
"tests/slicehost/requests/get_image_tests.rb",
|
336
|
+
"tests/slicehost/requests/get_images_tests.rb",
|
337
|
+
"tests/slicehost/requests/get_slice_tests.rb",
|
338
|
+
"tests/slicehost/requests/get_slices_tests.rb",
|
339
|
+
"tests/slicehost/requests/reboot_slice_tests.rb",
|
340
|
+
"tests/slicehost/slicehost_helper.rb",
|
341
|
+
"tests/test_helper.rb",
|
342
|
+
"tests/test_helper_tests.rb"
|
340
343
|
]
|
341
344
|
s.homepage = %q{http://github.com/geemus/fog}
|
342
345
|
s.rdoc_options = ["--charset=UTF-8"]
|
@@ -449,16 +452,6 @@ Gem::Specification.new do |s|
|
|
449
452
|
"spec/slicehost/models/flavors_spec.rb",
|
450
453
|
"spec/slicehost/models/server_spec.rb",
|
451
454
|
"spec/slicehost/models/servers_spec.rb",
|
452
|
-
"spec/slicehost/requests/create_slice_spec.rb",
|
453
|
-
"spec/slicehost/requests/delete_slice_spec.rb",
|
454
|
-
"spec/slicehost/requests/get_backups_spec.rb",
|
455
|
-
"spec/slicehost/requests/get_flavor_spec.rb",
|
456
|
-
"spec/slicehost/requests/get_flavors_spec.rb",
|
457
|
-
"spec/slicehost/requests/get_image_spec.rb",
|
458
|
-
"spec/slicehost/requests/get_images_spec.rb",
|
459
|
-
"spec/slicehost/requests/get_slice_spec.rb",
|
460
|
-
"spec/slicehost/requests/get_slices_spec.rb",
|
461
|
-
"spec/slicehost/requests/reboot_slice_spec.rb",
|
462
455
|
"spec/spec_helper.rb"
|
463
456
|
]
|
464
457
|
|
@@ -42,10 +42,12 @@ module Fog
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
directory.files.merge_attributes(options)
|
45
|
-
|
46
|
-
data['
|
47
|
-
|
45
|
+
files = data['Contents']
|
46
|
+
while data['IsTruncated']
|
47
|
+
data = connection.get_bucket(name, options.merge!('marker' => files.last['Key'])).body
|
48
|
+
files.concat(data['Contents'])
|
48
49
|
end
|
50
|
+
directory.files.load(files)
|
49
51
|
directory
|
50
52
|
rescue Excon::Errors::NotFound
|
51
53
|
nil
|
@@ -38,6 +38,7 @@ module Fog
|
|
38
38
|
unless bucket_name
|
39
39
|
raise ArgumentError.new('bucket_name is required')
|
40
40
|
end
|
41
|
+
options.reject! {|key, value| !['prefix', 'marker', 'max-keys', 'delimiter'].include?(key)}
|
41
42
|
query = ''
|
42
43
|
for key, value in options
|
43
44
|
query << "#{key}=#{CGI.escape(value.to_s).gsub(/\+/, '%20')};"
|
data/lib/fog/collection.rb
CHANGED
data/lib/fog/model.rb
CHANGED
data/lib/fog/slicehost.rb
CHANGED
@@ -66,7 +66,7 @@ module Fog
|
|
66
66
|
def request(params)
|
67
67
|
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}")
|
68
68
|
headers = {
|
69
|
-
'Authorization' => "Basic #{Base64.encode64(@slicehost_password).
|
69
|
+
'Authorization' => "Basic #{Base64.encode64(@slicehost_password).delete("\r\n")}"
|
70
70
|
}
|
71
71
|
case params[:method]
|
72
72
|
when 'DELETE', 'GET', 'HEAD'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Shindo.tests('Slicehost#create_slice', 'slicehost') do
|
2
|
+
tests('success') do
|
3
|
+
|
4
|
+
before do
|
5
|
+
@data = Slicehost[:slices].create_slice(1, 3, 'fogcreateslice').body
|
6
|
+
@id = @data['id']
|
7
|
+
end
|
8
|
+
|
9
|
+
after do
|
10
|
+
wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
|
11
|
+
Slicehost[:slices].delete_slice(@id)
|
12
|
+
end
|
13
|
+
|
14
|
+
test('has proper output format') do
|
15
|
+
validate_data_format(@data, Slicehost::Formats::SLICE.merge('root-password' => String))
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Shindo.tests('Slicehost#delete_slice', 'slicehost') do
|
2
|
+
tests('success') do
|
3
|
+
|
4
|
+
before do
|
5
|
+
@data = Slicehost[:slices].create_slice(1, 3, 'fogdeleteslice').body
|
6
|
+
@id = @data['id']
|
7
|
+
end
|
8
|
+
|
9
|
+
test('has proper output format') do
|
10
|
+
wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
|
11
|
+
Slicehost[:slices].delete_slice(@id)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
tests('failure') do
|
17
|
+
|
18
|
+
test('raises NotFound error if slice does not exist') do
|
19
|
+
begin
|
20
|
+
Slicehost[:slices].delete_slice(0)
|
21
|
+
false
|
22
|
+
rescue Excon::Errors::NotFound
|
23
|
+
true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Shindo.tests('Slicehost#get_backups', 'slicehost') do
|
2
|
+
tests('success') do
|
3
|
+
|
4
|
+
before do
|
5
|
+
@data = Slicehost[:slices].get_backups.body
|
6
|
+
end
|
7
|
+
|
8
|
+
# TODO: ensure this still works with a non-empty list
|
9
|
+
test('has proper output format') do
|
10
|
+
validate_data_format(@data, { 'backups' => [Slicehost::Formats::BACKUP] })
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Shindo.tests('Slicehost#get_flavor', 'slicehost') do
|
2
|
+
tests('success') do
|
3
|
+
|
4
|
+
test('has proper output format') do
|
5
|
+
@data = Slicehost[:slices].get_flavor(1).body
|
6
|
+
validate_data_format(@data, Slicehost::Formats::FLAVOR)
|
7
|
+
end
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
tests('failure') do
|
12
|
+
|
13
|
+
test('raises Forbidden error if flavor does not exist') do
|
14
|
+
begin
|
15
|
+
Slicehost[:slices].get_flavor(0)
|
16
|
+
false
|
17
|
+
rescue Excon::Errors::Forbidden
|
18
|
+
true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Shindo.tests('Slicehost#get_image', 'slicehost') do
|
2
|
+
tests('success') do
|
3
|
+
|
4
|
+
test('has proper output format') do
|
5
|
+
@data = Slicehost[:slices].get_image(3).body
|
6
|
+
validate_data_format(@data, Slicehost::Formats::IMAGE)
|
7
|
+
end
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
tests('failure') do
|
12
|
+
|
13
|
+
test('raises Forbidden error if flavor does not exist') do
|
14
|
+
begin
|
15
|
+
Slicehost[:slices].get_image(0)
|
16
|
+
false
|
17
|
+
rescue Excon::Errors::Forbidden
|
18
|
+
true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
Shindo.tests('Slicehost#get_slice', 'slicehost') do
|
2
|
+
tests('success') do
|
3
|
+
|
4
|
+
before do
|
5
|
+
@data = Slicehost[:slices].create_slice(1, 3, 'foggetslice').body
|
6
|
+
@id = @data['id']
|
7
|
+
end
|
8
|
+
|
9
|
+
after do
|
10
|
+
wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
|
11
|
+
Slicehost[:slices].delete_slice(@id)
|
12
|
+
end
|
13
|
+
|
14
|
+
test('has proper output format') do
|
15
|
+
@data = Slicehost[:slices].get_slice(@id).body
|
16
|
+
validate_data_format(@data, Slicehost::Formats::SLICE)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
tests('failure') do
|
22
|
+
|
23
|
+
test('raises Forbidden error if flavor does not exist') do
|
24
|
+
begin
|
25
|
+
Slicehost[:slices].get_slice(0)
|
26
|
+
false
|
27
|
+
rescue Excon::Errors::Forbidden
|
28
|
+
true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
Shindo.tests('Slicehost#reboot_slice', 'slicehost') do
|
2
|
+
tests('success') do
|
3
|
+
|
4
|
+
before do
|
5
|
+
@data = Slicehost[:slices].create_slice(1, 3, 'fogrebootslice').body
|
6
|
+
@id = @data['id']
|
7
|
+
wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
|
8
|
+
@data = Slicehost[:slices].reboot_slice(@id).body
|
9
|
+
end
|
10
|
+
|
11
|
+
after do
|
12
|
+
wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
|
13
|
+
Slicehost[:slices].delete_slice(@id)
|
14
|
+
end
|
15
|
+
|
16
|
+
test('has proper output format') do
|
17
|
+
validate_data_format(@data, Slicehost::Formats::SLICE)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
tests('failure') do
|
23
|
+
|
24
|
+
test('raises Forbidden error if flavor does not exist') do
|
25
|
+
begin
|
26
|
+
Slicehost[:slices].reboot_slice(0)
|
27
|
+
false
|
28
|
+
rescue Excon::Errors::Forbidden
|
29
|
+
true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Slicehost
|
2
|
+
|
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 :slices
|
10
|
+
Fog::Slicehost.new(credentials)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
@@connections[service]
|
14
|
+
end
|
15
|
+
|
16
|
+
module Formats
|
17
|
+
|
18
|
+
BACKUP = {
|
19
|
+
'date' => String,
|
20
|
+
'id' => Integer,
|
21
|
+
'name' => String,
|
22
|
+
'slice-id' => Integer
|
23
|
+
}
|
24
|
+
|
25
|
+
FLAVOR = {
|
26
|
+
'id' => Integer,
|
27
|
+
'name' => String,
|
28
|
+
'price' => Integer,
|
29
|
+
'ram' => Integer
|
30
|
+
}
|
31
|
+
|
32
|
+
IMAGE = {
|
33
|
+
'id' => Integer,
|
34
|
+
'name' => String
|
35
|
+
}
|
36
|
+
|
37
|
+
SLICE = {
|
38
|
+
'addresses' => [String],
|
39
|
+
'bw-in' => Float,
|
40
|
+
'bw-out' => Float,
|
41
|
+
'flavor-id' => Integer,
|
42
|
+
'id' => Integer,
|
43
|
+
'image-id' => Integer,
|
44
|
+
'name' => String,
|
45
|
+
'progress' => Integer,
|
46
|
+
'status' => String
|
47
|
+
}
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'fog'))
|
2
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'fog', 'bin'))
|
3
|
+
|
4
|
+
# TODO: Currently is true even if some of the keys in format do not appear in
|
5
|
+
def validate_data_format(original_data, format)
|
6
|
+
valid = true
|
7
|
+
data = original_data.dup
|
8
|
+
for key, value in format
|
9
|
+
valid &&= data.has_key?(key)
|
10
|
+
datum = data.delete(key)
|
11
|
+
case value
|
12
|
+
when Array
|
13
|
+
valid &&= datum.is_a?(Array)
|
14
|
+
for element in datum
|
15
|
+
type = value.first
|
16
|
+
if type.is_a?(Hash)
|
17
|
+
valid &&= validate_data_format({:element => element}, {:element => type})
|
18
|
+
else
|
19
|
+
valid &&= element.is_a?(type)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
when Hash
|
23
|
+
valid &&= datum.is_a?(Hash)
|
24
|
+
valid &&= validate_data_format(datum, value)
|
25
|
+
else
|
26
|
+
valid &&= datum.is_a?(value)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
unless data.empty?
|
30
|
+
p "validate_data_format did not validate [#{data.inspect}]"
|
31
|
+
end
|
32
|
+
valid &&= data.empty?
|
33
|
+
end
|
34
|
+
|
35
|
+
def wait_for(timeout = 600, &block)
|
36
|
+
start = Time.now
|
37
|
+
until instance_eval(&block)
|
38
|
+
if Time.now - start > timeout
|
39
|
+
break
|
40
|
+
end
|
41
|
+
sleep(1)
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
|
2
|
+
|
3
|
+
Shindo.tests('test_helper') do
|
4
|
+
tests('#validate_data_format') do
|
5
|
+
|
6
|
+
tests('returns true') do
|
7
|
+
|
8
|
+
test('when format of value matches') do
|
9
|
+
validate_data_format({:a => :b}, {:a => Symbol})
|
10
|
+
end
|
11
|
+
|
12
|
+
test('when format of nested array elements matches') do
|
13
|
+
validate_data_format({:a => [:b, :c]}, {:a => [Symbol]})
|
14
|
+
end
|
15
|
+
|
16
|
+
test('when format of nested hash matches') do
|
17
|
+
validate_data_format({:a => {:b => :c}}, {:a => {:b => Symbol}})
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
tests('returns false') do
|
23
|
+
|
24
|
+
test('when format of value does not match') do
|
25
|
+
!validate_data_format({:a => :b}, {:a => String})
|
26
|
+
end
|
27
|
+
|
28
|
+
test('when not all keys are checked') do
|
29
|
+
!validate_data_format({:a => :b}, {})
|
30
|
+
end
|
31
|
+
|
32
|
+
test('when some keys do not appear') do
|
33
|
+
!validate_data_format({}, {:a => String})
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 60
|
9
|
+
version: 0.0.60
|
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-03-
|
17
|
+
date: 2010-03-28 00:00:00 -07:00
|
18
18
|
default_executable: fog
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -410,17 +410,20 @@ files:
|
|
410
410
|
- spec/slicehost/models/flavors_spec.rb
|
411
411
|
- spec/slicehost/models/server_spec.rb
|
412
412
|
- spec/slicehost/models/servers_spec.rb
|
413
|
-
- spec/slicehost/requests/create_slice_spec.rb
|
414
|
-
- spec/slicehost/requests/delete_slice_spec.rb
|
415
|
-
- spec/slicehost/requests/get_backups_spec.rb
|
416
|
-
- spec/slicehost/requests/get_flavor_spec.rb
|
417
|
-
- spec/slicehost/requests/get_flavors_spec.rb
|
418
|
-
- spec/slicehost/requests/get_image_spec.rb
|
419
|
-
- spec/slicehost/requests/get_images_spec.rb
|
420
|
-
- spec/slicehost/requests/get_slice_spec.rb
|
421
|
-
- spec/slicehost/requests/get_slices_spec.rb
|
422
|
-
- spec/slicehost/requests/reboot_slice_spec.rb
|
423
413
|
- spec/spec_helper.rb
|
414
|
+
- tests/slicehost/requests/create_slice_tests.rb
|
415
|
+
- tests/slicehost/requests/delete_slice_tests.rb
|
416
|
+
- tests/slicehost/requests/get_backups_tests.rb
|
417
|
+
- tests/slicehost/requests/get_flavor_tests.rb
|
418
|
+
- tests/slicehost/requests/get_flavors_tests.rb
|
419
|
+
- tests/slicehost/requests/get_image_tests.rb
|
420
|
+
- tests/slicehost/requests/get_images_tests.rb
|
421
|
+
- tests/slicehost/requests/get_slice_tests.rb
|
422
|
+
- tests/slicehost/requests/get_slices_tests.rb
|
423
|
+
- tests/slicehost/requests/reboot_slice_tests.rb
|
424
|
+
- tests/slicehost/slicehost_helper.rb
|
425
|
+
- tests/test_helper.rb
|
426
|
+
- tests/test_helper_tests.rb
|
424
427
|
has_rdoc: true
|
425
428
|
homepage: http://github.com/geemus/fog
|
426
429
|
licenses: []
|
@@ -556,14 +559,4 @@ test_files:
|
|
556
559
|
- spec/slicehost/models/flavors_spec.rb
|
557
560
|
- spec/slicehost/models/server_spec.rb
|
558
561
|
- spec/slicehost/models/servers_spec.rb
|
559
|
-
- spec/slicehost/requests/create_slice_spec.rb
|
560
|
-
- spec/slicehost/requests/delete_slice_spec.rb
|
561
|
-
- spec/slicehost/requests/get_backups_spec.rb
|
562
|
-
- spec/slicehost/requests/get_flavor_spec.rb
|
563
|
-
- spec/slicehost/requests/get_flavors_spec.rb
|
564
|
-
- spec/slicehost/requests/get_image_spec.rb
|
565
|
-
- spec/slicehost/requests/get_images_spec.rb
|
566
|
-
- spec/slicehost/requests/get_slice_spec.rb
|
567
|
-
- spec/slicehost/requests/get_slices_spec.rb
|
568
|
-
- spec/slicehost/requests/reboot_slice_spec.rb
|
569
562
|
- spec/spec_helper.rb
|
@@ -1,30 +0,0 @@
|
|
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[:slices].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[:slices].create_slice(1, 3, 'fog_create_slice').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
|
-
@slice_id = actual['id']
|
22
|
-
actual['image-id'].should be_an(Integer)
|
23
|
-
actual['name'].should be_an(String)
|
24
|
-
actual['progress'].should be_an(Integer)
|
25
|
-
actual['root-password'].should be_a(String)
|
26
|
-
actual['status'].should be_an(String)
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
@@ -1,18 +0,0 @@
|
|
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[:slices].create_slice(1, 3, 'fog_delete_slice').body['id']
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should return proper attributes" do
|
12
|
-
eventually(128) do
|
13
|
-
actual = Slicehost[:slices].delete_slice(@slice_id)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
@@ -1,17 +0,0 @@
|
|
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[:slices].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
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
-
|
3
|
-
describe 'Slicehost.get_flavor' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
it "should return proper attributes" do
|
7
|
-
actual = Slicehost[:slices].get_flavor(1).body
|
8
|
-
actual['id'].should be_an(Integer)
|
9
|
-
actual['name'].should be_an(String)
|
10
|
-
actual['price'].should be_a(Integer)
|
11
|
-
actual['ram'].should be_an(Integer)
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
describe 'failure' do
|
16
|
-
|
17
|
-
it "should raise a Forbidden error if the flavor does not exist" do
|
18
|
-
lambda {
|
19
|
-
Slicehost[:slices].get_flavor(0)
|
20
|
-
}.should raise_error(Excon::Errors::Forbidden)
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
@@ -1,17 +0,0 @@
|
|
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[:slices].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
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
-
|
3
|
-
describe 'Slicehost.get_image' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
it "should return proper attributes" do
|
7
|
-
actual = Slicehost[:slices].get_image.body
|
8
|
-
actual['id'].should be_an(Integer)
|
9
|
-
actual['name'].should be_a(String)
|
10
|
-
end
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
describe 'failure' do
|
15
|
-
|
16
|
-
it "should raise a Forbidden error if the flavor does not exist" do
|
17
|
-
lambda {
|
18
|
-
Slicehost[:slices].get_image(0)
|
19
|
-
}.should raise_error(Excon::Errors::Forbidden)
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
@@ -1,15 +0,0 @@
|
|
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[:slices].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
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
-
|
3
|
-
describe 'Slicehost.get_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[:slices].create_slice(1, 3, 'fog_create_slice').body['id']
|
9
|
-
end
|
10
|
-
|
11
|
-
after(:each) do
|
12
|
-
eventually(128) do
|
13
|
-
Slicehost[:slices].delete_slice(@slice_id)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should return proper attributes" do
|
18
|
-
actual = Slicehost[:slices].get_slice(@slice_id).body
|
19
|
-
actual['addresses'].should be_a(Array)
|
20
|
-
# actual['backup-id'].should be_an(Integer)
|
21
|
-
actual['bw-in'].should be_a(Float)
|
22
|
-
actual['bw-out'].should be_a(Float)
|
23
|
-
actual['flavor-id'].should be_an(Integer)
|
24
|
-
actual['id'].should be_an(Integer)
|
25
|
-
actual['image-id'].should be_an(Integer)
|
26
|
-
actual['name'].should be_an(String)
|
27
|
-
actual['progress'].should be_an(Integer)
|
28
|
-
actual['status'].should be_an(String)
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
describe 'failure' do
|
33
|
-
|
34
|
-
it "should raise a Forbidden error if the server does not exist" do
|
35
|
-
lambda {
|
36
|
-
Slicehost[:slices].get_slice(0)
|
37
|
-
}.should raise_error(Excon::Errors::Forbidden)
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
-
|
3
|
-
describe 'Slicehost.get_slices' 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[:slices].create_slice(1, 3, 'fog_create_slice').body['id']
|
9
|
-
end
|
10
|
-
|
11
|
-
after(:each) do
|
12
|
-
eventually(128) do
|
13
|
-
Slicehost[:slices].delete_slice(@slice_id)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should return proper attributes" do
|
18
|
-
actual = Slicehost[:slices].get_slices.body
|
19
|
-
actual['slices'].should be_an(Array)
|
20
|
-
slice = actual['slices'].first
|
21
|
-
slice['addresses'].should be_a(Array)
|
22
|
-
# slice['backup-id'].should be_an(Integer)
|
23
|
-
slice['bw-in'].should be_a(Float)
|
24
|
-
slice['bw-out'].should be_a(Float)
|
25
|
-
slice['flavor-id'].should be_an(Integer)
|
26
|
-
slice['id'].should be_an(Integer)
|
27
|
-
slice['image-id'].should be_an(Integer)
|
28
|
-
slice['name'].should be_an(String)
|
29
|
-
slice['progress'].should be_an(Integer)
|
30
|
-
slice['status'].should be_an(String)
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
-
|
3
|
-
describe 'Slicehost.reboot_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[:slices].create_slice(1, 3, 'fog_create_slice').body['id']
|
9
|
-
wait_for { Slicehost[:slices].get_slice(@slice_id).body['status'] == 'active' }
|
10
|
-
end
|
11
|
-
|
12
|
-
after(:each) do
|
13
|
-
wait_for { Slicehost[:slices].get_slice(@slice_id).body['status'] == 'active' }
|
14
|
-
Slicehost[:slices].delete_slice(@slice_id)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should return proper attributes" do
|
18
|
-
actual = Slicehost[:slices].reboot_slice(@slice_id).body
|
19
|
-
actual['addresses'].should be_a(Array)
|
20
|
-
# actual['backup-id'].should be_an(Integer)
|
21
|
-
actual['bw-in'].should be_a(Float)
|
22
|
-
actual['bw-out'].should be_a(Float)
|
23
|
-
actual['flavor-id'].should be_an(Integer)
|
24
|
-
actual['id'].should be_an(Integer)
|
25
|
-
actual['image-id'].should be_an(Integer)
|
26
|
-
actual['name'].should be_an(String)
|
27
|
-
actual['progress'].should be_an(Integer)
|
28
|
-
actual['status'].should be_an(String)
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
describe 'failure' do
|
33
|
-
|
34
|
-
it "should raise a Forbidden error if the server does not exist" do
|
35
|
-
lambda {
|
36
|
-
Slicehost[:slices].reboot_slice(0)
|
37
|
-
}.should raise_error(Excon::Errors::Forbidden)
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
end
|