deltacloud-core 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -42,10 +42,9 @@ module DeltacloudUnitTest
42
42
  end
43
43
 
44
44
  def test_it_responses_to_png
45
- do_request '/api/instance_states', {}, false, { :format => :png }
45
+ do_request '/api/instance_states', { :format => 'png' }, false
46
46
  last_response.status.should == 200
47
47
  last_response.headers['Content-Type'].should == 'image/png'
48
- #last_response.headers['Content-Length'].should == '4371'
49
48
  end
50
49
 
51
50
  end
@@ -70,8 +70,9 @@ module DeltacloudUnitTest
70
70
  params = {
71
71
  :image_id => 'img1'
72
72
  }
73
- post '/api/instances', params, authenticate(:format => :xml)
74
- last_response.status.should == 302
73
+ header 'Accept', accept_header(:xml)
74
+ post '/api/instances', params, authenticate
75
+ last_response.status.should == 201
75
76
  last_response.headers['Location'].should_not == nil
76
77
  do_xml_request last_response.headers['Location'], {}, true
77
78
  (last_xml_response/'instance/name').should_not == nil
@@ -84,8 +85,9 @@ module DeltacloudUnitTest
84
85
  :image_id => 'img1',
85
86
  :name => "unit_test_instance1"
86
87
  }
88
+ header 'Accept', accept_header(:xml)
87
89
  post '/api/instances', params, authenticate(:format => :xml)
88
- last_response.status.should == 302
90
+ last_response.status.should == 201
89
91
  last_response.headers['Location'].should_not == nil
90
92
  do_xml_request last_response.headers['Location'], {}, true
91
93
  (last_xml_response/'instance/name').text.should == 'unit_test_instance1'
@@ -99,8 +101,9 @@ module DeltacloudUnitTest
99
101
  :name => "unit_test_instance1",
100
102
  :hwp_id => "m1-xlarge"
101
103
  }
104
+ header 'Accept', accept_header(:xml)
102
105
  post '/api/instances', params, authenticate(:format => :xml)
103
- last_response.status.should == 302
106
+ last_response.status.should == 201
104
107
  last_response.headers['Location'].should_not == nil
105
108
  do_xml_request last_response.headers['Location'], {}, true
106
109
  (last_xml_response/'instance/name').text.should == 'unit_test_instance1'
@@ -114,7 +117,7 @@ module DeltacloudUnitTest
114
117
  do_xml_request "/api/instances/#{instance_id}", {}, true
115
118
  stop_url = (last_xml_response/'actions/link[@rel="stop"]').first['href']
116
119
  stop_url.should_not == nil
117
- post create_url(stop_url), {}, authenticate(:format => :xml)
120
+ post create_url(stop_url), { :format => 'xml' }, authenticate
118
121
  last_response.status.should == 200
119
122
  instance = Nokogiri::XML(last_response.body)
120
123
  test_instance_attributes(instance)
@@ -122,7 +125,7 @@ module DeltacloudUnitTest
122
125
  do_xml_request "/api/instances/#{instance_id}", {}, true
123
126
  start_url = (last_xml_response/'actions/link[@rel="start"]').first['href']
124
127
  start_url.should_not == nil
125
- post create_url(start_url), {}, authenticate(:format => :xml)
128
+ post create_url(start_url), { :format => 'xml'}, authenticate
126
129
  last_response.status.should == 200
127
130
  instance = Nokogiri::XML(last_response.body)
128
131
  test_instance_attributes(instance)
@@ -135,7 +138,7 @@ module DeltacloudUnitTest
135
138
  do_xml_request "/api/instances/#{instance_id}", {}, true
136
139
  reboot_url = (last_xml_response/'actions/link[@rel="reboot"]').first['href']
137
140
  reboot_url.should_not == nil
138
- post create_url(reboot_url), {}, authenticate(:format => :xml)
141
+ post create_url(reboot_url), { :format => "xml"}, authenticate
139
142
  last_response.status.should == 200
140
143
  instance = Nokogiri::XML(last_response.body)
141
144
  test_instance_attributes(instance)
@@ -148,7 +151,7 @@ module DeltacloudUnitTest
148
151
  do_xml_request "/api/instances/#{instance_id}", {}, true
149
152
  stop_url = (last_xml_response/'actions/link[@rel="stop"]').first['href']
150
153
  stop_url.should_not == nil
151
- post create_url(stop_url), {}, authenticate(:format => :xml)
154
+ post create_url(stop_url), {}, authenticate
152
155
  last_response.status.should == 200
153
156
  instance = Nokogiri::XML(last_response.body)
154
157
  test_instance_attributes(instance)
@@ -161,7 +164,7 @@ module DeltacloudUnitTest
161
164
  do_xml_request "/api/instances/#{instance_id}", {}, true
162
165
  destroy_url = (last_xml_response/'actions/link[@rel="destroy"]').first['href']
163
166
  destroy_url.should_not == nil
164
- delete create_url(destroy_url), {}, authenticate(:format => :xml)
167
+ delete create_url(destroy_url), {}, authenticate
165
168
  last_response.status.should == 302
166
169
  do_xml_request last_response.headers['Location'], {}, true
167
170
  (last_xml_response/'instances').should_not == nil
@@ -30,7 +30,7 @@ module DeltacloudUnitTest
30
30
 
31
31
  def verify_url_for(url, expected_url, mode=:path_only, params={}, rack_env={})
32
32
  # generate a unique url for each test
33
- test_url = "/url_for_test/#{expected_url.hash}/#{Time.now.to_f}"
33
+ test_url = "/url_for_test/#{expected_url.hash}/#{Time.now.to_i}"
34
34
  # Create our sinatra test endpoint
35
35
  self.class.create_test_url_content(test_url, url, mode)
36
36
 
@@ -0,0 +1,20 @@
1
+ %h1 Blob
2
+ %h2
3
+ = @blob.id
4
+
5
+ %dl
6
+ %dt bucket
7
+ %dd
8
+ = @blob.bucket
9
+ %dt Content_Length
10
+ %dd
11
+ = @blob.content_length
12
+ %dt Content_Type
13
+ %dd
14
+ = @blob.content_type
15
+ %dt Last_Modified
16
+ %dd
17
+ = @blob.last_modified
18
+ %dt Content
19
+ %dd
20
+ =link_to 'Blob content', bucket_url(@blob.bucket) + '/' + @blob.id + '/content'
@@ -0,0 +1,7 @@
1
+ !!! XML
2
+ %blob{:href => bucket_url(@blob.bucket) + '/' + @blob.id, :id => @blob.id}
3
+ - @blob.attributes.select{ |attr| attr!=:id}.each do |attribute|
4
+ - unless attribute == :content
5
+ - haml_tag(attribute, :<) do
6
+ - haml_concat @blob.send(attribute)
7
+ %content{:href => bucket_url(@blob.bucket) + '/' + @blob.id + '/content'}
@@ -0,0 +1,33 @@
1
+ %h1
2
+ Buckets
3
+ %br
4
+ %p
5
+ =link_to 'Create new bucket', "/api/buckets/new"
6
+
7
+ %table.display
8
+ %thead
9
+ %tr
10
+ %th
11
+ ID
12
+ %th
13
+ Name
14
+ %th
15
+ Size
16
+ %th
17
+ Blob List
18
+ %th
19
+
20
+ %tbody
21
+ - @buckets.each do |bucket|
22
+ %tr
23
+ %td
24
+ = link_to bucket.id, bucket_url(bucket.id)
25
+ %td
26
+ = bucket.name
27
+ %td
28
+ = bucket.size
29
+ %td
30
+ -bucket.blob_list.each do |blob|
31
+ = blob
32
+ %td
33
+ =link_to 'Delete', destroy_bucket_url(bucket.name), :class => 'delete'
@@ -0,0 +1,10 @@
1
+ !!! XML
2
+ %buckets
3
+ - @elements.each do |bucket|
4
+ %bucket{:href => bucket_url(bucket.id), :id => bucket.id}
5
+ - bucket.attributes.select{ |attr| attr!=:id }.each do |attribute|
6
+ - unless attribute == :blob_list
7
+ - haml_tag("#{attribute}".tr('-', '_'), :<) do
8
+ - haml_concat bucket.send(attribute)
9
+ - bucket.blob_list.each do |blb|
10
+ %blob{ :id => blb, :href => bucket_url(bucket.id) +"/#{blb}"}
@@ -0,0 +1,13 @@
1
+ %h1 New Bucket
2
+
3
+ %form{ :action => buckets_url, :method => :post }
4
+ %label
5
+ Bucket Name:
6
+ %input{ :name => 'name', :size => 250}/
7
+ %br
8
+ -if driver_has_bucket_location_feature?
9
+ %p
10
+ %label
11
+ Location: (optional)
12
+ %input{ :name => 'location', :size => 20 }/
13
+ %input{ :type => :submit, :name => "commit", :value => "create"}/
@@ -0,0 +1,19 @@
1
+ %h1 Bucket
2
+ %h2
3
+ = @bucket.id
4
+
5
+ %dl
6
+ %di
7
+ %dt Name
8
+ %dd
9
+ = @bucket.name
10
+ %dt Size
11
+ %dd
12
+ = @bucket.size
13
+ %dt Blobs
14
+ %dd
15
+ -@bucket.blob_list.each do |blob|
16
+ = link_to blob, bucket_url(@bucket.name) + '/' + blob
17
+ %dt delete bucket (must be empty)
18
+ %dd
19
+ =link_to 'Delete', destroy_bucket_url(@bucket.name), :class => 'delete'
@@ -0,0 +1,8 @@
1
+ !!! XML
2
+ %bucket{:href => bucket_url(@bucket.id), :id => @bucket.id}
3
+ - @bucket.attributes.select{ |attr| attr!=:id }.each do |attribute|
4
+ - unless attribute == :blob_list
5
+ -haml_tag(attribute, :<) do
6
+ - haml_concat @bucket.send(attribute)
7
+ - @bucket.blob_list.each do |blb|
8
+ %blob{:id => blb, :href => bucket_url(@bucket.id) +"/#{blb}"}
@@ -1,7 +1,7 @@
1
1
  %h1 Instance States
2
2
 
3
3
  %div#state_graph
4
- = image_tag url_for( '/api/instance_states.png' )
4
+ = image_tag url_for( '/api/instance_states?format=png' )
5
5
 
6
6
  %table.states
7
7
  %thead
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deltacloud-core
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Red Hat, Inc.
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-10 00:00:00 +02:00
18
+ date: 2010-09-30 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -99,9 +99,25 @@ dependencies:
99
99
  type: :runtime
100
100
  version_requirements: *id005
101
101
  - !ruby/object:Gem::Dependency
102
- name: thin
102
+ name: rack-accept
103
103
  prerelease: false
104
104
  requirement: &id006 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ hash: 9
110
+ segments:
111
+ - 0
112
+ - 4
113
+ - 3
114
+ version: 0.4.3
115
+ type: :runtime
116
+ version_requirements: *id006
117
+ - !ruby/object:Gem::Dependency
118
+ name: thin
119
+ prerelease: false
120
+ requirement: &id007 !ruby/object:Gem::Requirement
105
121
  none: false
106
122
  requirements:
107
123
  - - ">="
@@ -113,11 +129,11 @@ dependencies:
113
129
  - 5
114
130
  version: 1.2.5
115
131
  type: :runtime
116
- version_requirements: *id006
132
+ version_requirements: *id007
117
133
  - !ruby/object:Gem::Dependency
118
134
  name: rerun
119
135
  prerelease: false
120
- requirement: &id007 !ruby/object:Gem::Requirement
136
+ requirement: &id008 !ruby/object:Gem::Requirement
121
137
  none: false
122
138
  requirements:
123
139
  - - ">="
@@ -129,11 +145,11 @@ dependencies:
129
145
  - 2
130
146
  version: 0.5.2
131
147
  type: :runtime
132
- version_requirements: *id007
148
+ version_requirements: *id008
133
149
  - !ruby/object:Gem::Dependency
134
150
  name: json
135
151
  prerelease: false
136
- requirement: &id008 !ruby/object:Gem::Requirement
152
+ requirement: &id009 !ruby/object:Gem::Requirement
137
153
  none: false
138
154
  requirements:
139
155
  - - ">="
@@ -141,15 +157,15 @@ dependencies:
141
157
  hash: 1
142
158
  segments:
143
159
  - 1
144
- - 4
145
- - 3
146
- version: 1.4.3
160
+ - 1
161
+ - 9
162
+ version: 1.1.9
147
163
  type: :runtime
148
- version_requirements: *id008
164
+ version_requirements: *id009
149
165
  - !ruby/object:Gem::Dependency
150
166
  name: compass
151
167
  prerelease: false
152
- requirement: &id009 !ruby/object:Gem::Requirement
168
+ requirement: &id010 !ruby/object:Gem::Requirement
153
169
  none: false
154
170
  requirements:
155
171
  - - ">="
@@ -161,11 +177,11 @@ dependencies:
161
177
  - 17
162
178
  version: 0.8.17
163
179
  type: :development
164
- version_requirements: *id009
180
+ version_requirements: *id010
165
181
  - !ruby/object:Gem::Dependency
166
182
  name: nokogiri
167
183
  prerelease: false
168
- requirement: &id010 !ruby/object:Gem::Requirement
184
+ requirement: &id011 !ruby/object:Gem::Requirement
169
185
  none: false
170
186
  requirements:
171
187
  - - ">="
@@ -177,11 +193,11 @@ dependencies:
177
193
  - 1
178
194
  version: 1.4.1
179
195
  type: :development
180
- version_requirements: *id010
196
+ version_requirements: *id011
181
197
  - !ruby/object:Gem::Dependency
182
198
  name: rack-test
183
199
  prerelease: false
184
- requirement: &id011 !ruby/object:Gem::Requirement
200
+ requirement: &id012 !ruby/object:Gem::Requirement
185
201
  none: false
186
202
  requirements:
187
203
  - - ">="
@@ -193,11 +209,11 @@ dependencies:
193
209
  - 3
194
210
  version: 0.5.3
195
211
  type: :development
196
- version_requirements: *id011
212
+ version_requirements: *id012
197
213
  - !ruby/object:Gem::Dependency
198
214
  name: cucumber
199
215
  prerelease: false
200
- requirement: &id012 !ruby/object:Gem::Requirement
216
+ requirement: &id013 !ruby/object:Gem::Requirement
201
217
  none: false
202
218
  requirements:
203
219
  - - ">="
@@ -209,11 +225,11 @@ dependencies:
209
225
  - 3
210
226
  version: 0.6.3
211
227
  type: :development
212
- version_requirements: *id012
228
+ version_requirements: *id013
213
229
  - !ruby/object:Gem::Dependency
214
230
  name: rcov
215
231
  prerelease: false
216
- requirement: &id013 !ruby/object:Gem::Requirement
232
+ requirement: &id014 !ruby/object:Gem::Requirement
217
233
  none: false
218
234
  requirements:
219
235
  - - ">="
@@ -225,7 +241,7 @@ dependencies:
225
241
  - 8
226
242
  version: 0.9.8
227
243
  type: :development
228
- version_requirements: *id013
244
+ version_requirements: *id014
229
245
  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"
230
246
  email: deltacloud-users@lists.fedorahosted.org
231
247
  executables:
@@ -242,13 +258,13 @@ files:
242
258
  - server.rb
243
259
  - support/fedora/rubygem-deltacloud-core.spec
244
260
  - support/fedora/deltacloudd
245
- - lib/drivers.rb
246
- - lib/sinatra/respond_to.rb
247
261
  - lib/sinatra/lazy_auth.rb
248
262
  - lib/sinatra/accept_media_types.rb
249
263
  - lib/sinatra/static_assets.rb
250
264
  - lib/sinatra/url_for.rb
251
265
  - lib/sinatra/rabbit.rb
266
+ - lib/sinatra/respond_to_old.rb
267
+ - lib/sinatra/respond_to.rb
252
268
  - lib/deltacloud/models/base_model.rb
253
269
  - lib/deltacloud/models/realm.rb
254
270
  - lib/deltacloud/models/instance.rb
@@ -257,6 +273,8 @@ files:
257
273
  - lib/deltacloud/models/storage_volume.rb
258
274
  - lib/deltacloud/models/storage_snapshot.rb
259
275
  - lib/deltacloud/models/image.rb
276
+ - lib/deltacloud/models/blob.rb
277
+ - lib/deltacloud/models/bucket.rb
260
278
  - lib/deltacloud/method_serializer.rb
261
279
  - lib/deltacloud/helpers.rb
262
280
  - lib/deltacloud/drivers/ec2/ec2_mock_driver.rb
@@ -265,25 +283,28 @@ files:
265
283
  - lib/deltacloud/drivers/gogrid/test.rb
266
284
  - lib/deltacloud/drivers/gogrid/gogrid_client.rb
267
285
  - lib/deltacloud/drivers/gogrid/gogrid_driver.rb
268
- - lib/deltacloud/drivers/opennebula/opennebula_driver.rb
269
286
  - lib/deltacloud/drivers/opennebula/occi_client.rb
270
287
  - lib/deltacloud/drivers/opennebula/cloud_client.rb
288
+ - lib/deltacloud/drivers/opennebula/opennebula_driver.rb
271
289
  - lib/deltacloud/drivers/mock/mock_driver.rb
272
290
  - lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb
273
291
  - lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb
274
292
  - lib/deltacloud/drivers/rackspace/rackspace_client.rb
275
293
  - lib/deltacloud/drivers/rackspace/rackspace_driver.rb
276
294
  - lib/deltacloud/drivers/rhevm/rhevm_driver.rb
295
+ - lib/deltacloud/drivers/azure/azure_driver.rb
277
296
  - lib/deltacloud/hardware_profile.rb
278
297
  - lib/deltacloud/validation.rb
279
- - lib/deltacloud/base_driver/mock_driver.rb
280
298
  - lib/deltacloud/base_driver/base_driver.rb
281
299
  - lib/deltacloud/base_driver/features.rb
300
+ - lib/deltacloud/base_driver/mock_driver.rb
282
301
  - lib/deltacloud/helpers/hardware_profiles_helper.rb
283
- - lib/deltacloud/helpers/application_helper.rb
284
302
  - lib/deltacloud/helpers/conversion_helper.rb
303
+ - lib/deltacloud/helpers/blob_stream.rb
304
+ - lib/deltacloud/helpers/application_helper.rb
285
305
  - lib/deltacloud/state_machine.rb
286
306
  - lib/deltacloud/base_driver.rb
307
+ - lib/drivers.rb
287
308
  - lib/deltacloud/drivers/mock/data/storage_volumes/vol1.yml
288
309
  - lib/deltacloud/drivers/mock/data/storage_volumes/vol3.yml
289
310
  - lib/deltacloud/drivers/mock/data/storage_volumes/vol2.yml
@@ -348,7 +369,14 @@ files:
348
369
  - views/realms/index.xml.haml
349
370
  - views/realms/show.html.haml
350
371
  - views/realms/index.html.haml
351
- - views/instance_states/show.gv.erb
372
+ - views/blobs/show.html.haml
373
+ - views/blobs/show.xml.haml
374
+ - views/buckets/index.html.haml
375
+ - views/buckets/index.xml.haml
376
+ - views/buckets/new.html.haml
377
+ - views/buckets/show.html.haml
378
+ - views/buckets/show.xml.haml
379
+ - views/instance_states/show.png.erb
352
380
  - public/favicon.ico
353
381
  - public/images/topbar-bg.png
354
382
  - public/images/grid.png
@@ -362,12 +390,12 @@ files:
362
390
  - public/stylesheets/compiled/screen.css
363
391
  - bin/deltacloudd
364
392
  - COPYING
365
- - tests/instance_states_test.rb
366
393
  - tests/api_test.rb
367
- - tests/instances_test.rb
368
394
  - tests/hardware_profiles_test.rb
369
395
  - tests/realms_test.rb
370
396
  - tests/images_test.rb
397
+ - tests/instance_states_test.rb
398
+ - tests/instances_test.rb
371
399
  - tests/url_for_test.rb
372
400
  has_rdoc: true
373
401
  homepage: http://www.deltacloud.org
@@ -406,10 +434,10 @@ signing_key:
406
434
  specification_version: 3
407
435
  summary: Deltacloud REST API
408
436
  test_files:
409
- - tests/instance_states_test.rb
410
437
  - tests/api_test.rb
411
- - tests/instances_test.rb
412
438
  - tests/hardware_profiles_test.rb
413
439
  - tests/realms_test.rb
414
440
  - tests/images_test.rb
441
+ - tests/instance_states_test.rb
442
+ - tests/instances_test.rb
415
443
  - tests/url_for_test.rb