fog 0.0.84 → 0.0.85

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/Gemfile +1 -0
  2. data/Gemfile.lock +47 -37
  3. data/bin/fog +9 -10
  4. data/fog.gemspec +23 -4
  5. data/lib/fog.rb +19 -1
  6. data/lib/fog/aws.rb +23 -0
  7. data/lib/fog/aws/bin.rb +4 -0
  8. data/lib/fog/aws/ec2.rb +20 -27
  9. data/lib/fog/aws/elb.rb +115 -0
  10. data/lib/fog/aws/models/ec2/server.rb +7 -1
  11. data/lib/fog/aws/models/s3/directories.rb +4 -4
  12. data/lib/fog/aws/models/s3/directory.rb +13 -11
  13. data/lib/fog/aws/parsers/elb/deregister_instances_from_load_balancer.rb +26 -0
  14. data/lib/fog/aws/parsers/elb/describe_instance_health.rb +30 -0
  15. data/lib/fog/aws/parsers/elb/describe_load_balancers.rb +101 -0
  16. data/lib/fog/aws/parsers/elb/disable_availability_zones_for_load_balancer.rb +26 -0
  17. data/lib/fog/aws/parsers/elb/enable_availability_zones_for_load_balancer.rb +26 -0
  18. data/lib/fog/aws/parsers/elb/register_instances_with_load_balancer.rb +26 -0
  19. data/lib/fog/aws/requests/ec2/detach_volume.rb +2 -2
  20. data/lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb +45 -0
  21. data/lib/fog/aws/requests/elb/describe_instance_health.rb +44 -0
  22. data/lib/fog/aws/requests/elb/describe_load_balancers.rb +57 -0
  23. data/lib/fog/aws/requests/elb/disable_availability_zones_for_load_balancer.rb +44 -0
  24. data/lib/fog/aws/requests/elb/enable_availability_zones_for_load_balancer.rb +44 -0
  25. data/lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb +45 -0
  26. data/lib/fog/aws/s3.rb +8 -1
  27. data/lib/fog/aws/simpledb.rb +9 -18
  28. data/lib/fog/bin.rb +11 -1
  29. data/lib/fog/credentials.rb +1 -0
  30. data/lib/fog/local.rb +72 -0
  31. data/lib/fog/local/bin.rb +34 -0
  32. data/lib/fog/local/models/directories.rb +43 -0
  33. data/lib/fog/local/models/directory.rb +47 -0
  34. data/lib/fog/local/models/file.rb +58 -0
  35. data/lib/fog/local/models/files.rb +74 -0
  36. data/lib/fog/model.rb +2 -8
  37. data/lib/fog/rackspace/models/files/directories.rb +3 -3
  38. data/lib/fog/rackspace/models/files/directory.rb +8 -5
  39. data/lib/fog/rackspace/models/servers/server.rb +7 -3
  40. data/lib/fog/rackspace/requests/servers/create_server.rb +1 -1
  41. data/lib/fog/ssh.rb +91 -25
  42. data/lib/fog/terremark/bin.rb +1 -8
  43. data/lib/fog/terremark/ecloud.rb +14 -5
  44. data/lib/fog/terremark/models/shared/server.rb +54 -3
  45. data/lib/fog/terremark/parsers/shared/vapp.rb +1 -1
  46. data/lib/fog/terremark/requests/shared/get_network.rb +39 -1
  47. data/lib/fog/terremark/requests/shared/get_organization.rb +45 -1
  48. data/lib/fog/terremark/requests/shared/get_organizations.rb +2 -1
  49. data/lib/fog/terremark/requests/shared/get_public_ips.rb +32 -1
  50. data/lib/fog/terremark/requests/shared/get_vdc.rb +83 -1
  51. data/lib/fog/terremark/requests/shared/{reset.rb → power_reset.rb} +1 -1
  52. data/lib/fog/terremark/requests/shared/power_shutdown.rb +32 -0
  53. data/lib/fog/terremark/shared.rb +139 -18
  54. data/lib/fog/terremark/vcloud.rb +14 -5
  55. data/spec/aws/models/ec2/address_spec.rb +1 -3
  56. data/spec/aws/models/ec2/snapshot_spec.rb +25 -49
  57. data/spec/aws/models/ec2/snapshots_spec.rb +25 -31
  58. data/spec/aws/models/ec2/volume_spec.rb +9 -3
  59. data/spec/aws/models/s3/directory_spec.rb +14 -14
  60. data/spec/aws/requests/ec2/associate_address_spec.rb +4 -5
  61. data/spec/aws/requests/ec2/attach_volume_spec.rb +14 -16
  62. data/spec/aws/requests/ec2/create_snapshot_spec.rb +2 -3
  63. data/spec/aws/requests/ec2/delete_snapshot_spec.rb +5 -6
  64. data/spec/aws/requests/ec2/describe_instances_spec.rb +3 -2
  65. data/spec/aws/requests/ec2/describe_snapshots_spec.rb +21 -25
  66. data/spec/aws/requests/ec2/detach_volume_spec.rb +14 -16
  67. data/spec/aws/requests/ec2/disassociate_address_spec.rb +3 -4
  68. data/spec/aws/requests/ec2/get_console_output_spec.rb +1 -0
  69. data/spec/aws/requests/s3/get_service_spec.rb +5 -6
  70. data/spec/spec_helper.rb +0 -20
  71. data/tests/helper.rb +0 -10
  72. data/tests/rackspace/requests/servers/create_image_tests.rb +2 -2
  73. data/tests/rackspace/requests/servers/create_server_tests.rb +3 -2
  74. data/tests/rackspace/requests/servers/delete_image_tests.rb +2 -2
  75. data/tests/rackspace/requests/servers/delete_server_tests.rb +1 -1
  76. data/tests/rackspace/requests/servers/get_server_details_tests.rb +1 -1
  77. data/tests/rackspace/requests/servers/list_addresses_tests.rb +1 -1
  78. data/tests/rackspace/requests/servers/list_private_addresses_tests.rb +1 -1
  79. data/tests/rackspace/requests/servers/list_public_addresses_tests.rb +1 -1
  80. data/tests/rackspace/requests/servers/list_servers_detail_tests.rb +1 -1
  81. data/tests/rackspace/requests/servers/list_servers_tests.rb +1 -1
  82. data/tests/rackspace/requests/servers/reboot_server_tests.rb +3 -3
  83. data/tests/rackspace/requests/servers/update_server_tests.rb +1 -1
  84. data/tests/slicehost/requests/create_slice_tests.rb +1 -1
  85. data/tests/slicehost/requests/delete_slice_tests.rb +1 -1
  86. data/tests/slicehost/requests/get_slice_tests.rb +1 -1
  87. data/tests/slicehost/requests/reboot_slice_tests.rb +2 -2
  88. metadata +24 -5
  89. data/lib/fog/terremark/requests/shared/shutdown.rb +0 -43
@@ -5,6 +5,13 @@ module Fog
5
5
  module Bin
6
6
  end
7
7
 
8
+ module Defaults
9
+ HOST = 'services.vcloudexpress.terremark.com'
10
+ PATH = '/api/v0.8'
11
+ PORT = 443
12
+ SCHEME = 'https'
13
+ end
14
+
8
15
  extend Fog::Terremark::Shared
9
16
 
10
17
  def self.new(options={})
@@ -31,11 +38,10 @@ module Fog
31
38
  def initialize(options={})
32
39
  @terremark_password = options[:terremark_vcloud_password]
33
40
  @terremark_username = options[:terremark_vcloud_username]
34
- @host = options[:host] || "services.vcloudexpress.terremark.com"
35
- @path = options[:path] || "/api/v0.8"
36
- @port = options[:port] || 443
37
- @scheme = options[:scheme] || 'https'
38
- @cookie = get_organizations.headers['Set-Cookie']
41
+ @host = options[:host] || Fog::Terremark::Vcloud::Defaults::HOST
42
+ @path = options[:path] || Fog::Terremark::Vcloud::Defaults::PATH
43
+ @port = options[:port] || Fog::Terremark::Vcloud::Defaults::PORT
44
+ @scheme = options[:scheme] || Fog::Terremark::Vcloud::Defaults::SCHEME
39
45
  end
40
46
 
41
47
  def default_vdc_id
@@ -92,6 +98,9 @@ module Fog
92
98
 
93
99
  def initialize(option = {})
94
100
  super
101
+ @base_url = Fog::Terremark::Vcloud::Defaults::SCHEME + "://" +
102
+ Fog::Terremark::Vcloud::Defaults::HOST +
103
+ Fog::Terremark::Vcloud::Defaults::PATH
95
104
  @data = self.class.data[:terremark_vcloud_username]
96
105
  end
97
106
  end
@@ -44,9 +44,7 @@ describe 'Fog::AWS::EC2::Address' do
44
44
  end
45
45
 
46
46
  after(:each) do
47
- if @address.public_ip
48
- @address.destroy
49
- end
47
+ @address.destroy
50
48
  @server.destroy
51
49
  end
52
50
 
@@ -1,6 +1,22 @@
1
1
  require File.dirname(__FILE__) + '/../../../spec_helper'
2
2
 
3
- describe 'Fog::AWS::EC2::Snapshots' do
3
+ describe 'Fog::AWS::EC2::Snapshot' do
4
+
5
+ before(:all) do
6
+ @volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
7
+ @volume.wait_for { ready? }
8
+ end
9
+
10
+ after(:all) do
11
+ @volume.destroy
12
+ end
13
+
14
+ after(:each) do
15
+ if @snapshot && !@snapshot.new_record?
16
+ @snapshot.wait_for { ready? }
17
+ @snapshot.destroy
18
+ end
19
+ end
4
20
 
5
21
  describe "#initialize" do
6
22
 
@@ -17,27 +33,13 @@ describe 'Fog::AWS::EC2::Snapshots' do
17
33
 
18
34
  end
19
35
 
20
- describe "#collection" do
21
-
22
- it "should return a Fog::AWS::EC2::Snapshots" do
23
- AWS[:ec2].snapshots.new.collection.should be_a(Fog::AWS::EC2::Snapshots)
24
- end
25
-
26
- it "should be the snapshots the snapshot is related to" do
27
- snapshots = AWS[:ec2].snapshots
28
- snapshots.new.collection.should == snapshots
29
- end
30
-
31
- end
32
-
33
36
  describe "#destroy" do
34
37
 
35
38
  it "should return true if the snapshot is deleted" do
36
- volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
37
- snapshot = volume.snapshots.create
38
- snapshot.wait_for { ready? }
39
- snapshot.destroy.should be_true
40
- volume.destroy
39
+ @snapshot = @volume.snapshots.create
40
+ @snapshot.wait_for { ready? }
41
+ @snapshot.destroy.should be_true
42
+ @snapshot = nil # avoid the after(:each) block
41
43
  end
42
44
 
43
45
  end
@@ -45,22 +47,13 @@ describe 'Fog::AWS::EC2::Snapshots' do
45
47
  describe "#reload" do
46
48
 
47
49
  before(:each) do
48
- @volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
49
50
  @snapshot = @volume.snapshots.create
50
51
  @reloaded = @snapshot.reload
51
52
  end
52
53
 
53
- after(:each) do
54
- @snapshot.destroy
55
- @volume.destroy
56
- end
57
-
58
- it "should return a Fog::AWS::EC2::Snapshot" do
54
+ it "should match the original" do
59
55
  @reloaded.should be_a(Fog::AWS::EC2::Snapshot)
60
- end
61
-
62
- it "should reset attributes to remote state" do
63
- @snapshot.attributes.should == @reloaded.attributes
56
+ @reloaded.attributes.should == @snapshot.attributes
64
57
  end
65
58
 
66
59
  end
@@ -68,30 +61,13 @@ describe 'Fog::AWS::EC2::Snapshots' do
68
61
  describe "#save" do
69
62
 
70
63
  before(:each) do
71
- @volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
72
- @volume.wait_for { ready? }
73
64
  @snapshot = @volume.snapshots.new
74
65
  end
75
66
 
76
- after(:each) do
77
- @volume.destroy
78
- end
79
-
80
- it "should return true when it succeeds" do
81
- @snapshot.save.should be_true
82
- @snapshot.wait_for { ready? }
83
- @snapshot.destroy
84
- end
85
-
86
- it "should not exist in snapshots before save" do
67
+ it "should persist the snapshot" do
87
68
  AWS[:ec2].snapshots.get(@snapshot.id).should be_nil
88
- end
89
-
90
- it "should exist in snapshots after save" do
91
- @snapshot.save
69
+ @snapshot.save.should be_true
92
70
  AWS[:ec2].snapshots.get(@snapshot.id).should_not be_nil
93
- @snapshot.wait_for { ready? }
94
- @snapshot.destroy
95
71
  end
96
72
 
97
73
  end
@@ -2,31 +2,39 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
2
2
 
3
3
  describe 'Fog::AWS::EC2::Snapshots' do
4
4
 
5
+ before(:all) do
6
+ @volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
7
+ @volume.wait_for { ready? }
8
+ end
9
+
10
+ after(:all) do
11
+ @volume.destroy
12
+ end
13
+
14
+ after(:each) do
15
+ if @snapshot && !@snapshot.new_record?
16
+ @snapshot.wait_for { ready? }
17
+ @snapshot.destroy
18
+ end
19
+ end
20
+
5
21
  describe "#all" do
6
22
 
7
- it "should return a Fog::AWS::EC2::Snapshots" do
8
- AWS[:ec2].snapshots.all.should be_a(Fog::AWS::EC2::Snapshots)
23
+ before(:each) do
24
+ @snapshot = @volume.snapshots.create
9
25
  end
10
26
 
11
27
  it "should include persisted snapshots" do
12
- @volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
13
- eventually { @snapshot = @volume.snapshots.create }
14
28
  AWS[:ec2].snapshots.all.map {|snapshot| snapshot.id}.should include(@snapshot.id)
15
- @snapshot.destroy
16
- @volume.destroy
17
29
  end
18
30
 
19
31
  it "should limit snapshots by volume if present" do
20
- @volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
21
32
  @other_volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
22
- @volume.wait_for { ready?}
23
- @snapshot = @volume.snapshots.create
24
- @other_volume.snapshots.all.map {|snapshot| snapshot.id}.should_not include(@snapshot.id)
25
33
 
26
- @snapshot.wait_for { ready? }
27
- @snapshot.destroy
34
+ @volume.snapshots.map {|snapshot| snapshot.id}.should include(@snapshot.identity)
35
+ @other_volume.snapshots.map {|snapshot| snapshot.id}.should_not include(@snapshot.identity)
36
+
28
37
  @other_volume.destroy
29
- @volume.destroy
30
38
  end
31
39
 
32
40
  end
@@ -34,21 +42,9 @@ describe 'Fog::AWS::EC2::Snapshots' do
34
42
  describe "#create" do
35
43
 
36
44
  before(:each) do
37
- @volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
38
- @volume.wait_for { ready? }
39
45
  @snapshot = @volume.snapshots.create
40
46
  end
41
47
 
42
- after(:each) do
43
- @snapshot.wait_for { ready? }
44
- @snapshot.destroy
45
- @volume.destroy
46
- end
47
-
48
- it "should return a Fog::AWS::EC2::Snapshot" do
49
- @snapshot.should be_a(Fog::AWS::EC2::Snapshot)
50
- end
51
-
52
48
  it "should exist on ec2" do
53
49
  AWS[:ec2].snapshots.get(@snapshot.id).should_not be_nil
54
50
  end
@@ -58,12 +54,10 @@ describe 'Fog::AWS::EC2::Snapshots' do
58
54
  describe "#get" do
59
55
 
60
56
  it "should return a Fog::AWS::EC2::Snapshot if a matching snapshot exists" do
61
- volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
62
- snapshot = volume.snapshots.create
63
- snapshot.wait_for { ready? }
64
- get = AWS[:ec2].snapshots.get(snapshot.id)
65
- snapshot.attributes.should == get.attributes
66
- snapshot.destroy
57
+ @snapshot = @volume.snapshots.create
58
+ @snapshot.wait_for { ready? }
59
+ get = AWS[:ec2].snapshots.get(@snapshot.id)
60
+ @snapshot.attributes.should == get.attributes
67
61
  end
68
62
 
69
63
  it "should return nil if no matching address exists" do
@@ -46,14 +46,20 @@ describe 'Fog::AWS::EC2::Volume' do
46
46
  end
47
47
 
48
48
  describe "#server=" do
49
- before(:each) do
49
+ before(:all) do
50
50
  @server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI)
51
- @volume = AWS[:ec2].volumes.new(:availability_zone => @server.availability_zone, :size => 1, :device => '/dev/sdz1')
52
51
  @server.wait_for { ready? }
53
52
  end
54
53
 
55
- after(:each) do
54
+ after(:all) do
56
55
  @server.destroy
56
+ end
57
+
58
+ before(:each) do
59
+ @volume = AWS[:ec2].volumes.new(:availability_zone => @server.availability_zone, :size => 1, :device => '/dev/sdz1')
60
+ end
61
+
62
+ after(:each) do
57
63
  if @volume.id
58
64
  @volume.wait_for { state == 'attached' }
59
65
  @volume.server = nil
@@ -8,10 +8,10 @@ describe 'Fog::AWS::S3::Directory' do
8
8
  now = Time.now
9
9
  directory = Fog::AWS::S3::Directory.new(
10
10
  'CreationDate' => now,
11
- 'Name' => 'directoryname'
11
+ 'Key' => 'directorykey'
12
12
  )
13
13
  directory.creation_date.should == now
14
- directory.name.should == 'directoryname'
14
+ directory.key.should == 'directorykey'
15
15
  end
16
16
 
17
17
  end
@@ -28,12 +28,12 @@ describe 'Fog::AWS::S3::Directory' do
28
28
  describe "#destroy" do
29
29
 
30
30
  it "should return true if the directory is deleted" do
31
- directory = AWS[:s3].directories.create(:name => 'fogmodeldirectory')
31
+ directory = AWS[:s3].directories.create(:key => 'fogmodeldirectory')
32
32
  directory.destroy.should be_true
33
33
  end
34
34
 
35
35
  it "should return false if the directory does not exist" do
36
- directory = AWS[:s3].directories.new(:name => 'fogmodeldirectory')
36
+ directory = AWS[:s3].directories.new(:key => 'fogmodeldirectory')
37
37
  directory.destroy.should be_false
38
38
  end
39
39
 
@@ -42,7 +42,7 @@ describe 'Fog::AWS::S3::Directory' do
42
42
  describe "#location" do
43
43
 
44
44
  it "should return the location constraint" do
45
- directory = AWS[:s3].directories.create(:name => 'fogmodeleudirectory', :location => 'EU')
45
+ directory = AWS[:s3].directories.create(:key => 'fogmodeleudirectory', :location => 'EU')
46
46
  directory.location.should == 'EU'
47
47
  AWS[:eu_s3].directories.get('fogmodeleudirectory').destroy
48
48
  end
@@ -52,7 +52,7 @@ describe 'Fog::AWS::S3::Directory' do
52
52
  describe "#payer" do
53
53
 
54
54
  it "should return the request payment value" do
55
- directory = AWS[:s3].directories.create(:name => 'fogmodeldirectory')
55
+ directory = AWS[:s3].directories.create(:key => 'fogmodeldirectory')
56
56
  directory.payer.should == 'BucketOwner'
57
57
  directory.destroy.should be_true
58
58
  end
@@ -62,7 +62,7 @@ describe 'Fog::AWS::S3::Directory' do
62
62
  describe "#payer=" do
63
63
 
64
64
  it "should set the request payment value" do
65
- directory = AWS[:s3].directories.create(:name => 'fogmodeldirectory')
65
+ directory = AWS[:s3].directories.create(:key => 'fogmodeldirectory')
66
66
  (directory.payer = 'Requester').should == 'Requester'
67
67
  directory.destroy.should
68
68
  end
@@ -72,7 +72,7 @@ describe 'Fog::AWS::S3::Directory' do
72
72
  describe "#reload" do
73
73
 
74
74
  before(:each) do
75
- @directory = AWS[:s3].directories.create(:name => 'fogmodeldirectory')
75
+ @directory = AWS[:s3].directories.create(:key => 'fogmodeldirectory')
76
76
  @reloaded = @directory.reload
77
77
  end
78
78
 
@@ -89,7 +89,11 @@ describe 'Fog::AWS::S3::Directory' do
89
89
  describe "#save" do
90
90
 
91
91
  before(:each) do
92
- @directory = AWS[:s3].directories.new(:name => 'fogmodeldirectory')
92
+ @directory = AWS[:s3].directories.new(:key => 'fogmodeldirectory')
93
+ end
94
+
95
+ it "should not exist in directories before save" do
96
+ AWS[:s3].directories.all.map {|directory| directory.key}.include?(@directory.key).should be_false
93
97
  end
94
98
 
95
99
  it "should return true when it succeeds" do
@@ -97,13 +101,9 @@ describe 'Fog::AWS::S3::Directory' do
97
101
  @directory.destroy
98
102
  end
99
103
 
100
- it "should not exist in directories before save" do
101
- AWS[:s3].directories.all.map {|directory| directory.name}.include?(@directory.name).should be_false
102
- end
103
-
104
104
  it "should exist in directories after save" do
105
105
  @directory.save
106
- AWS[:s3].directories.all.map {|directory| directory.name}.include?(@directory.name).should be_true
106
+ AWS[:s3].directories.all.map {|directory| directory.key}.include?(@directory.key).should be_true
107
107
  @directory.destroy
108
108
  end
109
109
 
@@ -6,6 +6,7 @@ describe 'EC2.associate_address' do
6
6
  before(:each) do
7
7
  @instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
8
8
  @public_ip = AWS[:ec2].allocate_address.body['publicIp']
9
+ AWS[:ec2].servers.get(@instance_id).wait_for { ready? }
9
10
  end
10
11
 
11
12
  after(:each) do
@@ -14,11 +15,9 @@ describe 'EC2.associate_address' do
14
15
  end
15
16
 
16
17
  it "should return proper attributes" do
17
- eventually(128) do
18
- actual = AWS[:ec2].associate_address(@instance_id, @public_ip)
19
- actual.body['requestId'].should be_a(String)
20
- [false, true].should include(actual.body['return'])
21
- end
18
+ actual = AWS[:ec2].associate_address(@instance_id, @public_ip)
19
+ actual.body['requestId'].should be_a(String)
20
+ [false, true].should include(actual.body['return'])
22
21
  end
23
22
 
24
23
  end
@@ -6,28 +6,26 @@ describe 'EC2.attach_volume' do
6
6
  before(:each) do
7
7
  @instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
8
8
  @volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
9
+ AWS[:ec2].servers.get(@instance_id).wait_for { ready? }
10
+ AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
9
11
  end
10
12
 
11
13
  after(:each) do
12
- eventually do
13
- AWS[:ec2].detach_volume(@volume_id)
14
- end
15
- eventually do
16
- AWS[:ec2].delete_volume(@volume_id)
17
- AWS[:ec2].terminate_instances(@instance_id)
18
- end
14
+ AWS[:ec2].volumes.get(@volume_id).wait_for { state == 'attached' }
15
+ AWS[:ec2].detach_volume(@volume_id)
16
+ AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
17
+ AWS[:ec2].delete_volume(@volume_id)
18
+ AWS[:ec2].terminate_instances(@instance_id)
19
19
  end
20
20
 
21
21
  it "should return proper attributes" do
22
- eventually(128) do
23
- actual = AWS[:ec2].attach_volume(@instance_id, @volume_id, '/dev/sdh')
24
- actual.body['attachTime'].should be_a(Time)
25
- actual.body['device'].should be_a(String)
26
- actual.body['instanceId'].should be_a(String)
27
- actual.body['requestId'].should be_a(String)
28
- actual.body['status'].should be_a(String)
29
- actual.body['volumeId'].should be_a(String)
30
- end
22
+ actual = AWS[:ec2].attach_volume(@instance_id, @volume_id, '/dev/sdh')
23
+ actual.body['attachTime'].should be_a(Time)
24
+ actual.body['device'].should be_a(String)
25
+ actual.body['instanceId'].should be_a(String)
26
+ actual.body['requestId'].should be_a(String)
27
+ actual.body['status'].should be_a(String)
28
+ actual.body['volumeId'].should be_a(String)
31
29
  end
32
30
 
33
31
  end
@@ -9,9 +9,8 @@ describe 'EC2.create_snapshot' do
9
9
 
10
10
  after(:each) do
11
11
  AWS[:ec2].delete_volume(@volume_id)
12
- eventually do
13
- AWS[:ec2].delete_snapshot(@snapshot_id)
14
- end
12
+ AWS[:ec2].snapshots.get(@snapshot_id).wait_for { ready? }
13
+ AWS[:ec2].delete_snapshot(@snapshot_id)
15
14
  end
16
15
 
17
16
  it "should return proper attributes" do
@@ -13,12 +13,11 @@ describe 'EC2.delete_snapshot' do
13
13
  end
14
14
 
15
15
  it "should return proper attributes" do
16
- eventually do
17
- actual = AWS[:ec2].delete_snapshot(@snapshot_id)
18
- unless actual.body.empty?
19
- actual.body['requestId'].should be_a(String)
20
- [false, true].should include(actual.body['return'])
21
- end
16
+ AWS[:ec2].snapshots.get(@snapshot_id).wait_for { ready? }
17
+ actual = AWS[:ec2].delete_snapshot(@snapshot_id)
18
+ unless actual.body.empty?
19
+ actual.body['requestId'].should be_a(String)
20
+ [false, true].should include(actual.body['return'])
22
21
  end
23
22
  end
24
23