fog 0.0.42 → 0.0.43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. data/README.rdoc +1 -1
  2. data/Rakefile +1 -0
  3. data/VERSION.yml +2 -2
  4. data/bin/fog +23 -102
  5. data/fog.gemspec +48 -2
  6. data/lib/fog.rb +17 -46
  7. data/lib/fog/aws.rb +10 -4
  8. data/lib/fog/aws/bin.rb +69 -0
  9. data/lib/fog/aws/ec2.rb +82 -86
  10. data/lib/fog/aws/requests/ec2/authorize_security_group_ingress.rb +20 -16
  11. data/lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb +19 -15
  12. data/lib/fog/aws/requests/s3/get_object.rb +4 -0
  13. data/lib/fog/aws/requests/simpledb/select.rb +42 -24
  14. data/lib/fog/aws/s3.rb +28 -25
  15. data/lib/fog/aws/simpledb.rb +21 -17
  16. data/lib/fog/bin.rb +79 -0
  17. data/lib/fog/collection.rb +20 -9
  18. data/lib/fog/model.rb +9 -4
  19. data/lib/fog/rackspace.rb +10 -3
  20. data/lib/fog/rackspace/bin.rb +44 -0
  21. data/lib/fog/rackspace/files.rb +16 -9
  22. data/lib/fog/rackspace/requests/files/delete_container.rb +2 -1
  23. data/lib/fog/rackspace/requests/files/delete_object.rb +2 -1
  24. data/lib/fog/rackspace/requests/files/get_container.rb +2 -1
  25. data/lib/fog/rackspace/requests/files/get_containers.rb +2 -1
  26. data/lib/fog/rackspace/requests/files/head_container.rb +2 -1
  27. data/lib/fog/rackspace/requests/files/head_containers.rb +2 -1
  28. data/lib/fog/rackspace/requests/files/put_container.rb +2 -1
  29. data/lib/fog/rackspace/requests/files/put_object.rb +2 -1
  30. data/lib/fog/rackspace/requests/servers/get_flavor_details.rb +1 -0
  31. data/lib/fog/rackspace/requests/servers/list_flavors.rb +1 -0
  32. data/lib/fog/rackspace/requests/servers/list_flavors_detail.rb +1 -0
  33. data/lib/fog/rackspace/requests/servers/list_images.rb +0 -1
  34. data/lib/fog/rackspace/requests/servers/reboot_server.rb +2 -1
  35. data/lib/fog/rackspace/servers.rb +31 -26
  36. data/lib/fog/slicehost.rb +35 -17
  37. data/lib/fog/slicehost/bin.rb +42 -0
  38. data/lib/fog/slicehost/models/flavor.rb +41 -0
  39. data/lib/fog/slicehost/models/flavors.rb +33 -0
  40. data/lib/fog/slicehost/models/image.rb +13 -0
  41. data/lib/fog/slicehost/models/images.rb +35 -0
  42. data/lib/fog/slicehost/models/server.rb +55 -0
  43. data/lib/fog/slicehost/models/servers.rb +37 -0
  44. data/lib/fog/slicehost/parsers/get_flavor.rb +24 -0
  45. data/lib/fog/slicehost/parsers/get_image.rb +24 -0
  46. data/lib/fog/slicehost/parsers/get_slice.rb +29 -0
  47. data/lib/fog/slicehost/requests/create_slice.rb +2 -1
  48. data/lib/fog/slicehost/requests/delete_slice.rb +2 -1
  49. data/lib/fog/slicehost/requests/get_backups.rb +1 -0
  50. data/lib/fog/slicehost/requests/get_flavor.rb +42 -0
  51. data/lib/fog/slicehost/requests/get_flavors.rb +1 -0
  52. data/lib/fog/slicehost/requests/get_image.rb +40 -0
  53. data/lib/fog/slicehost/requests/get_images.rb +1 -0
  54. data/lib/fog/slicehost/requests/get_slice.rb +48 -0
  55. data/lib/fog/slicehost/requests/get_slices.rb +1 -0
  56. data/lib/fog/slicehost/requests/reboot_slice.rb +49 -0
  57. data/lib/fog/terremark.rb +71 -0
  58. data/lib/fog/terremark/bin.rb +30 -0
  59. data/lib/fog/terremark/parsers/get_catalog.rb +43 -0
  60. data/lib/fog/terremark/parsers/get_catalog_item.rb +44 -0
  61. data/lib/fog/terremark/parsers/get_organization.rb +44 -0
  62. data/lib/fog/terremark/parsers/get_organizations.rb +26 -0
  63. data/lib/fog/terremark/parsers/get_vapp_template.rb +44 -0
  64. data/lib/fog/terremark/parsers/get_vdc.rb +105 -0
  65. data/lib/fog/terremark/requests/get_catalog.rb +44 -0
  66. data/lib/fog/terremark/requests/get_catalog_item.rb +47 -0
  67. data/lib/fog/terremark/requests/get_organization.rb +46 -0
  68. data/lib/fog/terremark/requests/get_organizations.rb +42 -0
  69. data/lib/fog/terremark/requests/get_vapp_template.rb +47 -0
  70. data/lib/fog/terremark/requests/get_vdc.rb +47 -0
  71. data/spec/slicehost/models/server_spec.rb +51 -0
  72. data/spec/slicehost/models/servers_spec.rb +22 -0
  73. data/spec/slicehost/requests/get_flavor_spec.rb +24 -0
  74. data/spec/slicehost/requests/get_image_spec.rb +24 -0
  75. data/spec/slicehost/requests/get_slice_spec.rb +41 -0
  76. data/spec/slicehost/requests/get_slices_spec.rb +20 -9
  77. data/spec/slicehost/requests/reboot_slice_spec.rb +41 -0
  78. data/spec/spec_helper.rb +10 -0
  79. metadata +55 -2
@@ -0,0 +1,51 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+ require File.dirname(__FILE__) + '/../../shared_examples/server_examples'
3
+
4
+ describe 'Fog::Slicehost::Server' do
5
+
6
+ it_should_behave_like "Server"
7
+
8
+ # flavor 1 = 256, image 3 = gentoo 2008.0
9
+ subject { @server = @servers.new(:flavor_id => 1, :image_id => 3, :name => Time.now.to_i.to_s) }
10
+
11
+ before(:each) do
12
+ @servers = Slicehost[:slices].servers
13
+ end
14
+
15
+ after(:each) do
16
+ if @server && !@server.new_record?
17
+ @server.wait_for { ready? }
18
+ @server.destroy.should be_true
19
+ end
20
+ end
21
+
22
+ describe "#initialize" do
23
+
24
+ it "should remap attributes from parser" do
25
+ server = @servers.new({
26
+ 'addresses' => 'addresses',
27
+ 'backup-id' => 'backup_id',
28
+ 'bw-in' => 'bw_in',
29
+ 'bw-out' => 'bw_out',
30
+ 'flavor-id' => 'flavor_id',
31
+ 'image-id' => 'image_id',
32
+ 'name' => 'name',
33
+ 'root-password' => 'password',
34
+ 'progress' => 'progress',
35
+ 'status' => 'status'
36
+ })
37
+ server.addresses.should == 'addresses'
38
+ server.backup_id.should == 'backup_id'
39
+ server.bw_in.should == 'bw_in'
40
+ server.bw_out.should == 'bw_out'
41
+ server.flavor_id.should == 'flavor_id'
42
+ server.image_id.should == 'image_id'
43
+ server.name.should == 'name'
44
+ server.password.should == 'password'
45
+ server.progress.should == 'progress'
46
+ server.status.should == 'status'
47
+ end
48
+
49
+ end
50
+
51
+ end
@@ -0,0 +1,22 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+ require File.dirname(__FILE__) + '/../../shared_examples/servers_examples'
3
+
4
+ describe 'Fog::Slicehost::Servers' do
5
+
6
+ it_should_behave_like "Servers"
7
+
8
+ # flavor 1 = 256, image 3 = gentoo 2008.0
9
+ subject { @server = @servers.new(:flavor_id => 1, :image_id => 3, :name => Time.now.to_i.to_s) }
10
+
11
+ before(:each) do
12
+ @servers = Slicehost[:slices].servers
13
+ end
14
+
15
+ after(:each) do
16
+ if @server && !@server.new_record?
17
+ @server.wait_for { ready? }
18
+ @server.destroy.should be_true
19
+ end
20
+ end
21
+
22
+ end
@@ -0,0 +1,24 @@
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
@@ -0,0 +1,24 @@
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
@@ -0,0 +1,41 @@
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
@@ -3,20 +3,31 @@ require File.dirname(__FILE__) + '/../../spec_helper'
3
3
  describe 'Slicehost.get_slices' do
4
4
  describe 'success' do
5
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
+
6
17
  it "should return proper attributes" do
7
18
  actual = Slicehost[:slices].get_slices.body
8
19
  actual['slices'].should be_an(Array)
9
20
  slice = actual['slices'].first
10
- # slice['addresses'].should be_a(Array)
21
+ slice['addresses'].should be_a(Array)
11
22
  # 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)
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)
20
31
  end
21
32
 
22
33
  end
@@ -0,0 +1,41 @@
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
data/spec/spec_helper.rb CHANGED
@@ -100,6 +100,16 @@ def eventually(max_delay = 16, &block)
100
100
  end
101
101
  end
102
102
 
103
+ def wait_for(timeout = 600, &block)
104
+ start = Time.now
105
+ until instance_eval(&block)
106
+ if Time.now - start > timeout
107
+ break
108
+ end
109
+ sleep(1)
110
+ end
111
+ end
112
+
103
113
  unless defined?(GENTOO_AMI)
104
114
  GENTOO_AMI = 'ami-5ee70037'
105
115
  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.42
4
+ version: 0.0.43
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: 2010-02-01 00:00:00 -08:00
12
+ date: 2010-02-15 00:00:00 -08:00
13
13
  default_executable: fog
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,6 +22,16 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 0.0.18
24
24
  version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: formatador
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: json
27
37
  type: :runtime
@@ -83,6 +93,7 @@ files:
83
93
  - fog.gemspec
84
94
  - lib/fog.rb
85
95
  - lib/fog/aws.rb
96
+ - lib/fog/aws/bin.rb
86
97
  - lib/fog/aws/ec2.rb
87
98
  - lib/fog/aws/models/ec2/address.rb
88
99
  - lib/fog/aws/models/ec2/addresses.rb
@@ -185,11 +196,13 @@ files:
185
196
  - lib/fog/aws/requests/simpledb/select.rb
186
197
  - lib/fog/aws/s3.rb
187
198
  - lib/fog/aws/simpledb.rb
199
+ - lib/fog/bin.rb
188
200
  - lib/fog/collection.rb
189
201
  - lib/fog/connection.rb
190
202
  - lib/fog/model.rb
191
203
  - lib/fog/parser.rb
192
204
  - lib/fog/rackspace.rb
205
+ - lib/fog/rackspace/bin.rb
193
206
  - lib/fog/rackspace/files.rb
194
207
  - lib/fog/rackspace/models/servers/flavor.rb
195
208
  - lib/fog/rackspace/models/servers/flavors.rb
@@ -224,17 +237,45 @@ files:
224
237
  - lib/fog/rackspace/requests/servers/update_server.rb
225
238
  - lib/fog/rackspace/servers.rb
226
239
  - lib/fog/slicehost.rb
240
+ - lib/fog/slicehost/bin.rb
241
+ - lib/fog/slicehost/models/flavor.rb
242
+ - lib/fog/slicehost/models/flavors.rb
243
+ - lib/fog/slicehost/models/image.rb
244
+ - lib/fog/slicehost/models/images.rb
245
+ - lib/fog/slicehost/models/server.rb
246
+ - lib/fog/slicehost/models/servers.rb
227
247
  - lib/fog/slicehost/parsers/create_slice.rb
228
248
  - lib/fog/slicehost/parsers/get_backups.rb
249
+ - lib/fog/slicehost/parsers/get_flavor.rb
229
250
  - lib/fog/slicehost/parsers/get_flavors.rb
251
+ - lib/fog/slicehost/parsers/get_image.rb
230
252
  - lib/fog/slicehost/parsers/get_images.rb
253
+ - lib/fog/slicehost/parsers/get_slice.rb
231
254
  - lib/fog/slicehost/parsers/get_slices.rb
232
255
  - lib/fog/slicehost/requests/create_slice.rb
233
256
  - lib/fog/slicehost/requests/delete_slice.rb
234
257
  - lib/fog/slicehost/requests/get_backups.rb
258
+ - lib/fog/slicehost/requests/get_flavor.rb
235
259
  - lib/fog/slicehost/requests/get_flavors.rb
260
+ - lib/fog/slicehost/requests/get_image.rb
236
261
  - lib/fog/slicehost/requests/get_images.rb
262
+ - lib/fog/slicehost/requests/get_slice.rb
237
263
  - lib/fog/slicehost/requests/get_slices.rb
264
+ - lib/fog/slicehost/requests/reboot_slice.rb
265
+ - lib/fog/terremark.rb
266
+ - lib/fog/terremark/bin.rb
267
+ - lib/fog/terremark/parsers/get_catalog.rb
268
+ - lib/fog/terremark/parsers/get_catalog_item.rb
269
+ - lib/fog/terremark/parsers/get_organization.rb
270
+ - lib/fog/terremark/parsers/get_organizations.rb
271
+ - lib/fog/terremark/parsers/get_vapp_template.rb
272
+ - lib/fog/terremark/parsers/get_vdc.rb
273
+ - lib/fog/terremark/requests/get_catalog.rb
274
+ - lib/fog/terremark/requests/get_catalog_item.rb
275
+ - lib/fog/terremark/requests/get_organization.rb
276
+ - lib/fog/terremark/requests/get_organizations.rb
277
+ - lib/fog/terremark/requests/get_vapp_template.rb
278
+ - lib/fog/terremark/requests/get_vdc.rb
238
279
  - spec/aws/models/ec2/address_spec.rb
239
280
  - spec/aws/models/ec2/addresses_spec.rb
240
281
  - spec/aws/models/ec2/key_pair_spec.rb
@@ -332,12 +373,18 @@ files:
332
373
  - spec/rackspace/requests/servers/update_server_spec.rb
333
374
  - spec/shared_examples/server_examples.rb
334
375
  - spec/shared_examples/servers_examples.rb
376
+ - spec/slicehost/models/server_spec.rb
377
+ - spec/slicehost/models/servers_spec.rb
335
378
  - spec/slicehost/requests/create_slice_spec.rb
336
379
  - spec/slicehost/requests/delete_slice_spec.rb
337
380
  - spec/slicehost/requests/get_backups_spec.rb
381
+ - spec/slicehost/requests/get_flavor_spec.rb
338
382
  - spec/slicehost/requests/get_flavors_spec.rb
383
+ - spec/slicehost/requests/get_image_spec.rb
339
384
  - spec/slicehost/requests/get_images_spec.rb
385
+ - spec/slicehost/requests/get_slice_spec.rb
340
386
  - spec/slicehost/requests/get_slices_spec.rb
387
+ - spec/slicehost/requests/reboot_slice_spec.rb
341
388
  - spec/spec_helper.rb
342
389
  has_rdoc: true
343
390
  homepage: http://github.com/geemus/fog
@@ -497,10 +544,16 @@ test_files:
497
544
  - spec/rackspace/requests/servers/update_server_spec.rb
498
545
  - spec/shared_examples/server_examples.rb
499
546
  - spec/shared_examples/servers_examples.rb
547
+ - spec/slicehost/models/server_spec.rb
548
+ - spec/slicehost/models/servers_spec.rb
500
549
  - spec/slicehost/requests/create_slice_spec.rb
501
550
  - spec/slicehost/requests/delete_slice_spec.rb
502
551
  - spec/slicehost/requests/get_backups_spec.rb
552
+ - spec/slicehost/requests/get_flavor_spec.rb
503
553
  - spec/slicehost/requests/get_flavors_spec.rb
554
+ - spec/slicehost/requests/get_image_spec.rb
504
555
  - spec/slicehost/requests/get_images_spec.rb
556
+ - spec/slicehost/requests/get_slice_spec.rb
505
557
  - spec/slicehost/requests/get_slices_spec.rb
558
+ - spec/slicehost/requests/reboot_slice_spec.rb
506
559
  - spec/spec_helper.rb