fog 0.0.83 → 0.0.84
Sign up to get free protection for your applications and to get access to all the features.
- data/fog.gemspec +2 -2
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/models/ec2/flavors.rb +1 -1
- data/lib/fog/aws/models/ec2/snapshots.rb +1 -1
- data/lib/fog/terremark/ecloud.rb +5 -0
- data/lib/fog/terremark/requests/shared/get_organizations.rb +10 -1
- data/lib/fog/terremark/shared.rb +32 -11
- data/lib/fog/terremark/vcloud.rb +5 -0
- data/spec/aws/models/ec2/snapshot_spec.rb +6 -5
- data/spec/aws/models/ec2/snapshots_spec.rb +8 -2
- data/spec/aws/models/ec2/volume_spec.rb +3 -3
- data/spec/aws/models/ec2/volumes_spec.rb +2 -1
- data/spec/aws/models/s3/directories_spec.rb +1 -1
- metadata +3 -3
data/fog.gemspec
CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
|
|
7
7
|
## If your rubyforge_project name is different, then edit it and comment out
|
8
8
|
## the sub! line in the Rakefile
|
9
9
|
s.name = 'fog'
|
10
|
-
s.version = '0.0.
|
11
|
-
s.date = '2010-04-
|
10
|
+
s.version = '0.0.84'
|
11
|
+
s.date = '2010-04-28'
|
12
12
|
s.rubyforge_project = 'fog'
|
13
13
|
|
14
14
|
## Make sure your summary is short. The description may be as long
|
data/lib/fog.rb
CHANGED
data/lib/fog/terremark/ecloud.rb
CHANGED
@@ -30,7 +30,16 @@ module Fog
|
|
30
30
|
module Mock
|
31
31
|
|
32
32
|
def get_organizations
|
33
|
-
|
33
|
+
response = Excon::Response.new
|
34
|
+
org_list = @data[:organizations].map do |organization|
|
35
|
+
{ "name" => organization[:info][:name],
|
36
|
+
"href" => "https://services.enterprisecloud.terremark.com/api/v0.8a-ext2.0/org/#{organization[:info][:id]}",
|
37
|
+
"type" => "application/vnd.vmware.vcloud.org+xml"
|
38
|
+
}
|
39
|
+
end
|
40
|
+
response.body = { "OrgList" => org_list }
|
41
|
+
response.headers = Fog::Terremark::Shared::Mock.headers(response.body, "application/vnd.vmware.vcloud.orgList+xml")
|
42
|
+
response
|
34
43
|
end
|
35
44
|
|
36
45
|
end
|
data/lib/fog/terremark/shared.rb
CHANGED
@@ -51,21 +51,42 @@ module Fog
|
|
51
51
|
end
|
52
52
|
|
53
53
|
module Mock
|
54
|
-
def self.data
|
55
|
-
@data ||= Hash.new do |hash, key|
|
56
|
-
hash[key] = {}
|
57
|
-
end
|
58
|
-
end
|
59
54
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
55
|
+
DATA = {
|
56
|
+
:organizations =>
|
57
|
+
[
|
58
|
+
{
|
59
|
+
:info => {
|
60
|
+
:name => "Boom Inc.",
|
61
|
+
:id => "1"
|
62
|
+
}
|
63
|
+
}
|
64
|
+
]
|
65
|
+
}
|
66
|
+
|
67
|
+
def self.headers(body, content_type)
|
68
|
+
{"X-Powered-By"=>"ASP.NET",
|
69
|
+
"Date"=> Time.now.to_s,
|
70
|
+
"Content-Type"=> content_type,
|
71
|
+
"Content-Length"=> body.to_s.length,
|
72
|
+
"Server"=>"Microsoft-IIS/7.0",
|
73
|
+
"Set-Cookie"=>"vcloud-token=ecb37bfc-56f0-421d-97e5-bf2gdf789457; path=/",
|
74
|
+
"Cache-Control"=>"private"}
|
64
75
|
end
|
65
76
|
|
66
77
|
def initialize(options={})
|
67
|
-
|
68
|
-
|
78
|
+
self.class.instance_eval '
|
79
|
+
def self.data
|
80
|
+
@data ||= Hash.new do |hash, key|
|
81
|
+
hash[key] = Fog::Terremark::Shared::Mock::DATA
|
82
|
+
end
|
83
|
+
end'
|
84
|
+
self.class.instance_eval '
|
85
|
+
def self.reset_data(keys=data.keys)
|
86
|
+
for key in [*keys]
|
87
|
+
data.delete(key)
|
88
|
+
end
|
89
|
+
end'
|
69
90
|
end
|
70
91
|
end
|
71
92
|
|
data/lib/fog/terremark/vcloud.rb
CHANGED
@@ -35,7 +35,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
35
35
|
it "should return true if the snapshot is deleted" do
|
36
36
|
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
37
37
|
snapshot = volume.snapshots.create
|
38
|
-
snapshot.wait_for {
|
38
|
+
snapshot.wait_for { ready? }
|
39
39
|
snapshot.destroy.should be_true
|
40
40
|
volume.destroy
|
41
41
|
end
|
@@ -69,6 +69,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
69
69
|
|
70
70
|
before(:each) do
|
71
71
|
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
72
|
+
@volume.wait_for { ready? }
|
72
73
|
@snapshot = @volume.snapshots.new
|
73
74
|
end
|
74
75
|
|
@@ -77,10 +78,9 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
77
78
|
end
|
78
79
|
|
79
80
|
it "should return true when it succeeds" do
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
end
|
81
|
+
@snapshot.save.should be_true
|
82
|
+
@snapshot.wait_for { ready? }
|
83
|
+
@snapshot.destroy
|
84
84
|
end
|
85
85
|
|
86
86
|
it "should not exist in snapshots before save" do
|
@@ -90,6 +90,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
90
90
|
it "should exist in snapshots after save" do
|
91
91
|
@snapshot.save
|
92
92
|
AWS[:ec2].snapshots.get(@snapshot.id).should_not be_nil
|
93
|
+
@snapshot.wait_for { ready? }
|
93
94
|
@snapshot.destroy
|
94
95
|
end
|
95
96
|
|
@@ -19,8 +19,11 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
19
19
|
it "should limit snapshots by volume if present" do
|
20
20
|
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
21
21
|
@other_volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
22
|
-
|
22
|
+
@volume.wait_for { ready?}
|
23
|
+
@snapshot = @volume.snapshots.create
|
23
24
|
@other_volume.snapshots.all.map {|snapshot| snapshot.id}.should_not include(@snapshot.id)
|
25
|
+
|
26
|
+
@snapshot.wait_for { ready? }
|
24
27
|
@snapshot.destroy
|
25
28
|
@other_volume.destroy
|
26
29
|
@volume.destroy
|
@@ -32,10 +35,12 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
32
35
|
|
33
36
|
before(:each) do
|
34
37
|
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
38
|
+
@volume.wait_for { ready? }
|
35
39
|
@snapshot = @volume.snapshots.create
|
36
40
|
end
|
37
41
|
|
38
42
|
after(:each) do
|
43
|
+
@snapshot.wait_for { ready? }
|
39
44
|
@snapshot.destroy
|
40
45
|
@volume.destroy
|
41
46
|
end
|
@@ -55,8 +60,9 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
55
60
|
it "should return a Fog::AWS::EC2::Snapshot if a matching snapshot exists" do
|
56
61
|
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
57
62
|
snapshot = volume.snapshots.create
|
63
|
+
snapshot.wait_for { ready? }
|
58
64
|
get = AWS[:ec2].snapshots.get(snapshot.id)
|
59
|
-
snapshot.attributes.
|
65
|
+
snapshot.attributes.should == get.attributes
|
60
66
|
snapshot.destroy
|
61
67
|
end
|
62
68
|
|
@@ -49,15 +49,15 @@ describe 'Fog::AWS::EC2::Volume' do
|
|
49
49
|
before(:each) do
|
50
50
|
@server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI)
|
51
51
|
@volume = AWS[:ec2].volumes.new(:availability_zone => @server.availability_zone, :size => 1, :device => '/dev/sdz1')
|
52
|
-
@server.wait_for {
|
52
|
+
@server.wait_for { ready? }
|
53
53
|
end
|
54
54
|
|
55
55
|
after(:each) do
|
56
56
|
@server.destroy
|
57
57
|
if @volume.id
|
58
|
-
@volume.wait_for {
|
58
|
+
@volume.wait_for { state == 'attached' }
|
59
59
|
@volume.server = nil
|
60
|
-
@volume.wait_for {
|
60
|
+
@volume.wait_for { ready? }
|
61
61
|
@volume.destroy
|
62
62
|
end
|
63
63
|
end
|
@@ -40,8 +40,9 @@ describe 'Fog::AWS::EC2::Volumes' do
|
|
40
40
|
|
41
41
|
it "should return a Fog::AWS::EC2::Volume if a matching volume exists" do
|
42
42
|
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
43
|
+
volume.wait_for { ready? }
|
43
44
|
get = AWS[:ec2].volumes.get(volume.id)
|
44
|
-
volume.attributes.
|
45
|
+
volume.attributes.should == get.attributes
|
45
46
|
volume.destroy
|
46
47
|
end
|
47
48
|
|
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
|
+
- 84
|
9
|
+
version: 0.0.84
|
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-04-
|
17
|
+
date: 2010-04-28 00:00:00 -07:00
|
18
18
|
default_executable: fog
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|