bbrowning-deltacloud-core 0.0.1.1 → 0.0.3.1
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/COPYING +176 -502
- data/Rakefile +21 -14
- data/deltacloud.rb +3 -0
- data/lib/deltacloud/base_driver/base_driver.rb +22 -11
- data/lib/deltacloud/base_driver.rb +12 -11
- data/lib/deltacloud/drivers/ec2/ec2_driver.rb +15 -12
- data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +16 -11
- data/lib/deltacloud/drivers/mock/data/images/img1.yml +3 -0
- data/lib/deltacloud/drivers/mock/data/images/img2.yml +3 -0
- data/lib/deltacloud/drivers/mock/data/images/img3.yml +3 -0
- data/lib/deltacloud/drivers/mock/data/instances/inst0.yml +16 -0
- data/lib/deltacloud/drivers/mock/data/instances/inst1.yml +9 -0
- data/lib/deltacloud/drivers/mock/data/instances/inst2.yml +9 -0
- data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap1.yml +4 -0
- data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap2.yml +4 -0
- data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap3.yml +4 -0
- data/lib/deltacloud/drivers/mock/data/storage_volumes/vol1.yml +6 -0
- data/lib/deltacloud/drivers/mock/data/storage_volumes/vol2.yml +6 -0
- data/lib/deltacloud/drivers/mock/data/storage_volumes/vol3.yml +6 -0
- data/lib/deltacloud/drivers/mock/mock_driver.rb +13 -11
- data/lib/deltacloud/drivers/rackspace/rackspace_client.rb +12 -11
- data/lib/deltacloud/drivers/rackspace/rackspace_driver.rb +12 -11
- data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +12 -11
- data/lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb +12 -11
- data/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb +14 -12
- data/lib/deltacloud/drivers/terremark/terremark_driver.rb +12 -11
- data/lib/deltacloud/helpers/application_helper.rb +64 -11
- data/lib/deltacloud/helpers/conversion_helper.rb +12 -11
- data/lib/deltacloud/method_serializer.rb +12 -11
- data/lib/deltacloud/models/base_model.rb +12 -11
- data/lib/deltacloud/models/image.rb +12 -11
- data/lib/deltacloud/models/instance.rb +13 -12
- data/lib/deltacloud/models/instance_profile.rb +12 -11
- data/lib/deltacloud/models/realm.rb +12 -11
- data/lib/deltacloud/models/storage_snapshot.rb +12 -11
- data/lib/deltacloud/models/storage_volume.rb +12 -11
- data/lib/drivers.rb +12 -0
- data/lib/sinatra/rabbit.rb +1 -0
- data/lib/sinatra/respond_to.rb +3 -0
- data/lib/sinatra/url_for.rb +3 -4
- data/server.rb +40 -80
- data/{torquebox-ec2-config.ru → support/torquebox/torquebox-ec2-config.ru} +0 -0
- data/tests/api_test.rb +37 -0
- data/tests/hardware_profiles_test.rb +120 -0
- data/tests/images_test.rb +95 -78
- data/tests/instance_states_test.rb +52 -0
- data/tests/instances_test.rb +193 -110
- data/tests/realms_test.rb +66 -44
- data/views/errors/not_found.html.haml +6 -0
- data/views/errors/not_found.xml.haml +2 -0
- data/views/hardware_profiles/index.xml.haml +1 -1
- data/views/hardware_profiles/show.xml.haml +3 -2
- data/views/images/index.xml.haml +4 -3
- data/views/images/show.xml.haml +2 -2
- data/views/instances/index.xml.haml +6 -8
- data/views/instances/show.xml.haml +9 -10
- data/views/realms/index.xml.haml +1 -3
- data/views/realms/show.xml.haml +4 -5
- data/views/storage_snapshots/index.xml.haml +3 -5
- data/views/storage_snapshots/show.xml.haml +2 -4
- data/views/storage_volumes/index.xml.haml +7 -7
- data/views/storage_volumes/show.xml.haml +2 -4
- metadata +37 -39
- data/tests/deltacloud_test.rb +0 -60
- data/tests/storage_snapshots_test.rb +0 -48
- data/tests/storage_volumes_test.rb +0 -48
@@ -1,13 +1,13 @@
|
|
1
1
|
!!!XML
|
2
|
-
%
|
2
|
+
%storage_volumes
|
3
3
|
- @elements.each do |volume|
|
4
|
-
%
|
5
|
-
%id<
|
6
|
-
=volume.id
|
4
|
+
%storage_volume{ :href => storage_volume_url(volume.id), :id => volume.id }
|
7
5
|
%created<
|
8
6
|
=volume.created
|
9
7
|
%capacity<
|
10
8
|
=volume.capacity
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
- unless volume.device.nil?
|
10
|
+
%device<
|
11
|
+
=volume.device
|
12
|
+
- unless volume.instance_id.nil?
|
13
|
+
%instance{:href => instance_url(volume.instance_id), :id => volume.instance_id}
|
@@ -1,7 +1,5 @@
|
|
1
1
|
!!!XML
|
2
|
-
%
|
3
|
-
%id<
|
4
|
-
=@storage_volume.id
|
2
|
+
%storage_volume{ :href => storage_volume_url(@storage_volume.id), :id => @storage_volume.id}
|
5
3
|
%created<
|
6
4
|
=@storage_volume.created
|
7
5
|
%capacity<
|
@@ -10,4 +8,4 @@
|
|
10
8
|
=@storage_volume.device
|
11
9
|
%state<
|
12
10
|
=@storage_volume.state
|
13
|
-
%instance{:href => @storage_volume.instance_id}
|
11
|
+
%instance{:href => @storage_volume.instance_id, :id => @storage_volume.instance_id}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bbrowning-deltacloud-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 65
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
+
- 3
|
9
10
|
- 1
|
10
|
-
|
11
|
-
version: 0.0.1.1
|
11
|
+
version: 0.0.3.1
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Red Hat, Inc.
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-07-
|
19
|
+
date: 2010-07-25 00:00:00 -04:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -83,26 +83,10 @@ dependencies:
|
|
83
83
|
version: 1.0.0
|
84
84
|
type: :runtime
|
85
85
|
version_requirements: *id004
|
86
|
-
- !ruby/object:Gem::Dependency
|
87
|
-
name: builder
|
88
|
-
prerelease: false
|
89
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
|
-
requirements:
|
92
|
-
- - ">="
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
hash: 15
|
95
|
-
segments:
|
96
|
-
- 2
|
97
|
-
- 1
|
98
|
-
- 2
|
99
|
-
version: 2.1.2
|
100
|
-
type: :runtime
|
101
|
-
version_requirements: *id005
|
102
86
|
- !ruby/object:Gem::Dependency
|
103
87
|
name: json_pure
|
104
88
|
prerelease: false
|
105
|
-
requirement: &
|
89
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
106
90
|
none: false
|
107
91
|
requirements:
|
108
92
|
- - ">="
|
@@ -114,11 +98,11 @@ dependencies:
|
|
114
98
|
- 3
|
115
99
|
version: 1.2.3
|
116
100
|
type: :runtime
|
117
|
-
version_requirements: *
|
101
|
+
version_requirements: *id005
|
118
102
|
- !ruby/object:Gem::Dependency
|
119
103
|
name: compass
|
120
104
|
prerelease: false
|
121
|
-
requirement: &
|
105
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
122
106
|
none: false
|
123
107
|
requirements:
|
124
108
|
- - ">="
|
@@ -130,11 +114,11 @@ dependencies:
|
|
130
114
|
- 17
|
131
115
|
version: 0.8.17
|
132
116
|
type: :development
|
133
|
-
version_requirements: *
|
117
|
+
version_requirements: *id006
|
134
118
|
- !ruby/object:Gem::Dependency
|
135
119
|
name: nokogiri
|
136
120
|
prerelease: false
|
137
|
-
requirement: &
|
121
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
138
122
|
none: false
|
139
123
|
requirements:
|
140
124
|
- - ">="
|
@@ -146,11 +130,11 @@ dependencies:
|
|
146
130
|
- 1
|
147
131
|
version: 1.4.1
|
148
132
|
type: :development
|
149
|
-
version_requirements: *
|
133
|
+
version_requirements: *id007
|
150
134
|
- !ruby/object:Gem::Dependency
|
151
135
|
name: rack-test
|
152
136
|
prerelease: false
|
153
|
-
requirement: &
|
137
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
154
138
|
none: false
|
155
139
|
requirements:
|
156
140
|
- - ">="
|
@@ -162,11 +146,11 @@ dependencies:
|
|
162
146
|
- 3
|
163
147
|
version: 0.5.3
|
164
148
|
type: :development
|
165
|
-
version_requirements: *
|
149
|
+
version_requirements: *id008
|
166
150
|
- !ruby/object:Gem::Dependency
|
167
151
|
name: cucumber
|
168
152
|
prerelease: false
|
169
|
-
requirement: &
|
153
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
170
154
|
none: false
|
171
155
|
requirements:
|
172
156
|
- - ">="
|
@@ -178,11 +162,11 @@ dependencies:
|
|
178
162
|
- 3
|
179
163
|
version: 0.6.3
|
180
164
|
type: :development
|
181
|
-
version_requirements: *
|
165
|
+
version_requirements: *id009
|
182
166
|
- !ruby/object:Gem::Dependency
|
183
167
|
name: rcov
|
184
168
|
prerelease: false
|
185
|
-
requirement: &
|
169
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
186
170
|
none: false
|
187
171
|
requirements:
|
188
172
|
- - ">="
|
@@ -194,7 +178,7 @@ dependencies:
|
|
194
178
|
- 8
|
195
179
|
version: 0.9.8
|
196
180
|
type: :development
|
197
|
-
version_requirements: *
|
181
|
+
version_requirements: *id010
|
198
182
|
description: " The Deltacloud API is built as a service-based REST API.\n You do not directly link a Deltacloud library into your program to use it.\n Instead, a client speaks the Deltacloud API over HTTP to a server\n which implements the REST interface.\n"
|
199
183
|
email: deltacloud-users@lists.fedorahosted.org
|
200
184
|
executables:
|
@@ -206,11 +190,11 @@ extra_rdoc_files:
|
|
206
190
|
files:
|
207
191
|
- Rakefile
|
208
192
|
- config.ru
|
209
|
-
- torquebox-ec2-config.ru
|
210
193
|
- server.rb
|
211
194
|
- deltacloud.rb
|
212
195
|
- support/fedora/rubygem-deltacloud-core.spec
|
213
196
|
- support/fedora/deltacloudd
|
197
|
+
- support/torquebox/torquebox-ec2-config.ru
|
214
198
|
- lib/sinatra/rabbit.rb
|
215
199
|
- lib/sinatra/respond_to.rb
|
216
200
|
- lib/sinatra/lazy_auth.rb
|
@@ -251,6 +235,18 @@ files:
|
|
251
235
|
- lib/deltacloud/models/instance_profile.rb
|
252
236
|
- lib/deltacloud/models/instance.rb
|
253
237
|
- lib/drivers.rb
|
238
|
+
- lib/deltacloud/drivers/mock/data/instances/inst1.yml
|
239
|
+
- lib/deltacloud/drivers/mock/data/instances/inst2.yml
|
240
|
+
- lib/deltacloud/drivers/mock/data/instances/inst0.yml
|
241
|
+
- lib/deltacloud/drivers/mock/data/storage_volumes/vol1.yml
|
242
|
+
- lib/deltacloud/drivers/mock/data/storage_volumes/vol3.yml
|
243
|
+
- lib/deltacloud/drivers/mock/data/storage_volumes/vol2.yml
|
244
|
+
- lib/deltacloud/drivers/mock/data/storage_snapshots/snap3.yml
|
245
|
+
- lib/deltacloud/drivers/mock/data/storage_snapshots/snap1.yml
|
246
|
+
- lib/deltacloud/drivers/mock/data/storage_snapshots/snap2.yml
|
247
|
+
- lib/deltacloud/drivers/mock/data/images/img2.yml
|
248
|
+
- lib/deltacloud/drivers/mock/data/images/img1.yml
|
249
|
+
- lib/deltacloud/drivers/mock/data/images/img3.yml
|
254
250
|
- views/instances/new.html.haml
|
255
251
|
- views/instances/show.html.haml
|
256
252
|
- views/instances/index.html.haml
|
@@ -265,6 +261,8 @@ files:
|
|
265
261
|
- views/api/show.xml.haml
|
266
262
|
- views/errors/auth_exception.html.haml
|
267
263
|
- views/errors/auth_exception.xml.haml
|
264
|
+
- views/errors/not_found.xml.haml
|
265
|
+
- views/errors/not_found.html.haml
|
268
266
|
- views/errors/backend_error.xml.haml
|
269
267
|
- views/errors/validation_failure.xml.haml
|
270
268
|
- views/errors/validation_failure.html.haml
|
@@ -310,12 +308,12 @@ files:
|
|
310
308
|
- public/stylesheets/compiled/application.css
|
311
309
|
- bin/deltacloudd
|
312
310
|
- COPYING
|
313
|
-
- tests/storage_volumes_test.rb
|
314
|
-
- tests/storage_snapshots_test.rb
|
315
311
|
- tests/realms_test.rb
|
312
|
+
- tests/hardware_profiles_test.rb
|
316
313
|
- tests/instances_test.rb
|
317
|
-
- tests/
|
314
|
+
- tests/instance_states_test.rb
|
318
315
|
- tests/images_test.rb
|
316
|
+
- tests/api_test.rb
|
319
317
|
has_rdoc: true
|
320
318
|
homepage: http://www.deltacloud.org
|
321
319
|
licenses: []
|
@@ -353,9 +351,9 @@ signing_key:
|
|
353
351
|
specification_version: 3
|
354
352
|
summary: Deltacloud REST API
|
355
353
|
test_files:
|
356
|
-
- tests/storage_volumes_test.rb
|
357
|
-
- tests/storage_snapshots_test.rb
|
358
354
|
- tests/realms_test.rb
|
355
|
+
- tests/hardware_profiles_test.rb
|
359
356
|
- tests/instances_test.rb
|
360
|
-
- tests/
|
357
|
+
- tests/instance_states_test.rb
|
361
358
|
- tests/images_test.rb
|
359
|
+
- tests/api_test.rb
|
data/tests/deltacloud_test.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'test/unit'
|
3
|
-
require 'rack/test'
|
4
|
-
require 'base64'
|
5
|
-
require 'nokogiri'
|
6
|
-
require 'pp'
|
7
|
-
require 'sinatra'
|
8
|
-
|
9
|
-
ENV['API_DRIVER']='mock'
|
10
|
-
ENV['API_HOST']='localhost'
|
11
|
-
|
12
|
-
require 'server'
|
13
|
-
|
14
|
-
set :environment => :test
|
15
|
-
|
16
|
-
module DeltacloudTest
|
17
|
-
include Rack::Test::Methods
|
18
|
-
|
19
|
-
def app
|
20
|
-
Sinatra::Application
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_if_response_is_valid
|
24
|
-
get '/api/'+@collection+'.xml', @params, rack_headers
|
25
|
-
assert last_response.ok?
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_if_http_status_is_correct_with_wrong_credentials
|
29
|
-
return if ['realms'].include?(@collection)
|
30
|
-
wrong_header = rack_headers
|
31
|
-
wrong_header['HTTP_AUTHORIZATION'] = authorization('wronguser', 'wrongpassword')
|
32
|
-
get '/api/'+@collection+'.xml', @params, wrong_header
|
33
|
-
assert_equal 403, last_response.status
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_if_index_operation_proper_root_element
|
37
|
-
get '/api/'+@collection+'.xml', @params, rack_headers
|
38
|
-
doc = Nokogiri::XML.parse(last_response.body)
|
39
|
-
assert_equal @collection.gsub('_', '-'), doc.root.name
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_html_response
|
43
|
-
get '/api/'+@collection+'.html', @params, rack_headers
|
44
|
-
doc = Nokogiri::HTML.parse(last_response.body)
|
45
|
-
assert_equal 'html', doc.root.name
|
46
|
-
end
|
47
|
-
|
48
|
-
def authorization(username, password)
|
49
|
-
"Basic " + Base64.encode64("#{username}:#{password}")
|
50
|
-
end
|
51
|
-
|
52
|
-
def rack_headers
|
53
|
-
return {
|
54
|
-
'HTTP_AUTHORIZATION' => authorization('mockuser', 'mockpassword'),
|
55
|
-
'SERVER_PORT' => '4040',
|
56
|
-
'Accept' => 'application/xml;q=1'
|
57
|
-
}
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'tests/deltacloud_test'
|
2
|
-
|
3
|
-
class StorageSnapshotsTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
def initialize(*args)
|
6
|
-
@collection = 'storage_snapshots'
|
7
|
-
@operations = [:index, :show]
|
8
|
-
@options = [:id, :architecture, :memory, :storage]
|
9
|
-
@params = {}
|
10
|
-
super(*args)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_if_storage_snapshots_are_not_empty
|
14
|
-
get '/api/storage_snapshots.xml', @params, rack_headers
|
15
|
-
doc = Nokogiri::XML.parse(last_response.body)
|
16
|
-
assert_not_equal 0, doc.xpath('/storage-snapshots/storage-snapshot').size
|
17
|
-
end
|
18
|
-
|
19
|
-
[:id, :created, :state, :'storage-volume'].each do |option|
|
20
|
-
method_name = :"test_if_storage_snapshots_index_contain_#{option}"
|
21
|
-
send :define_method, method_name do
|
22
|
-
get '/api/storage_snapshots.xml', @params, rack_headers
|
23
|
-
doc = Nokogiri::XML.parse(last_response.body)
|
24
|
-
storage_volume = doc.xpath('/storage-snapshots/storage-snapshot[1]').first
|
25
|
-
assert_not_nil storage_volume.xpath(option.to_s).first
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
[:id, :created, :state, :'storage-volume'].each do |option|
|
30
|
-
method_name = :"test_if_storage_volume_show_contain_#{option}"
|
31
|
-
send :define_method, method_name do
|
32
|
-
get '/api/storage_snapshots/snap3.xml', @params, rack_headers
|
33
|
-
doc = Nokogiri::XML.parse(last_response.body)
|
34
|
-
storage_volume = doc.xpath('/storage-snapshot').first
|
35
|
-
assert_not_nil storage_volume.xpath(option.to_s).first
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_storage_snapshots_filtering_by_id
|
40
|
-
get '/api/storage_snapshots.xml', { :id => 'snap3'}, rack_headers
|
41
|
-
doc = Nokogiri::XML.parse(last_response.body)
|
42
|
-
assert_equal 1, doc.xpath('/storage-snapshots/storage-snapshot').size
|
43
|
-
assert_equal 'snap3', doc.xpath('/storage-snapshots/storage-snapshot/id').first.text
|
44
|
-
end
|
45
|
-
|
46
|
-
include DeltacloudTest
|
47
|
-
|
48
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'tests/deltacloud_test'
|
2
|
-
|
3
|
-
class StorageVolumesTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
def initialize(*args)
|
6
|
-
@collection = 'storage_volumes'
|
7
|
-
@operations = [:index, :show]
|
8
|
-
@options = [:id, :architecture, :memory, :storage]
|
9
|
-
@params = {}
|
10
|
-
super(*args)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_if_storage_volumes_are_not_empty
|
14
|
-
get '/api/storage_volumes.xml', @params, rack_headers
|
15
|
-
doc = Nokogiri::XML.parse(last_response.body)
|
16
|
-
assert_not_equal 0, doc.xpath('/storage-volumes/storage-volume').size
|
17
|
-
end
|
18
|
-
|
19
|
-
[:id, :created, :capacity, :device, :state].each do |option|
|
20
|
-
method_name = :"test_if_storage_volumes_index_contain_#{option}"
|
21
|
-
send :define_method, method_name do
|
22
|
-
get '/api/storage_volumes.xml', @params, rack_headers
|
23
|
-
doc = Nokogiri::XML.parse(last_response.body)
|
24
|
-
storage_volume = doc.xpath('/storage-volumes/storage-volume[1]').first
|
25
|
-
assert_not_nil storage_volume.xpath(option.to_s).first
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
[:id, :created, :capacity, :device, :state].each do |option|
|
30
|
-
method_name = :"test_if_storage_volume_show_contain_#{option}"
|
31
|
-
send :define_method, method_name do
|
32
|
-
get '/api/storage_volumes/vol2.xml', @params, rack_headers
|
33
|
-
doc = Nokogiri::XML.parse(last_response.body)
|
34
|
-
storage_volume = doc.xpath('/storage-volume').first
|
35
|
-
assert_not_nil storage_volume.xpath(option.to_s).first
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_storage_volumes_filtering_by_id
|
40
|
-
get '/api/storage_volumes.xml', { :id => 'vol2'}, rack_headers
|
41
|
-
doc = Nokogiri::XML.parse(last_response.body)
|
42
|
-
assert_equal 1, doc.xpath('/storage-volumes/storage-volume').size
|
43
|
-
assert_equal 'vol2', doc.xpath('/storage-volumes/storage-volume/id').first.text
|
44
|
-
end
|
45
|
-
|
46
|
-
include DeltacloudTest
|
47
|
-
|
48
|
-
end
|