fog 0.0.32 → 0.0.33
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/fog.gemspec +5 -5
- data/lib/fog/aws/models/ec2/address.rb +1 -3
- data/lib/fog/aws/models/ec2/addresses.rb +5 -1
- data/lib/fog/aws/models/ec2/instance.rb +15 -15
- data/lib/fog/aws/models/ec2/security_group.rb +12 -12
- data/lib/fog/aws/models/ec2/snapshot.rb +4 -4
- data/lib/fog/aws/models/ec2/snapshots.rb +7 -7
- data/lib/fog/aws/models/ec2/volume.rb +9 -11
- data/lib/fog/aws/models/ec2/volumes.rb +6 -2
- data/lib/fog/aws/requests/s3/get_bucket.rb +1 -0
- data/lib/fog/aws/requests/s3/get_bucket_location.rb +1 -0
- data/lib/fog/aws/requests/s3/get_object.rb +1 -0
- data/lib/fog/aws/requests/s3/get_request_payment.rb +1 -0
- data/lib/fog/aws/requests/s3/get_service.rb +1 -0
- data/lib/fog/model.rb +13 -8
- data/spec/aws/models/ec2/address_spec.rb +3 -13
- data/spec/aws/models/ec2/instance_spec.rb +11 -9
- data/spec/aws/models/ec2/instances_spec.rb +3 -3
- data/spec/aws/models/ec2/key_pair_spec.rb +1 -1
- data/spec/aws/models/ec2/security_group_spec.rb +8 -8
- data/spec/aws/models/ec2/security_groups_spec.rb +8 -8
- data/spec/aws/models/ec2/snapshot_spec.rb +4 -4
- data/spec/aws/models/ec2/snapshots_spec.rb +6 -6
- data/spec/aws/models/ec2/volume_spec.rb +16 -19
- data/spec/aws/models/ec2/volumes_spec.rb +4 -4
- metadata +3 -3
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ require "#{current_directory}/lib/fog"
|
|
7
7
|
begin
|
8
8
|
require 'jeweler'
|
9
9
|
Jeweler::Tasks.new do |gem|
|
10
|
-
gem.add_dependency('excon', '>=0.0.
|
10
|
+
gem.add_dependency('excon', '>=0.0.11')
|
11
11
|
gem.add_dependency('mime-types')
|
12
12
|
gem.add_dependency('nokogiri')
|
13
13
|
gem.add_dependency('ruby-hmac')
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.33
|
data/fog.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fog}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.33"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["geemus (Wesley Beary)"]
|
12
|
-
s.date = %q{2009-12-
|
12
|
+
s.date = %q{2009-12-08}
|
13
13
|
s.default_executable = %q{fog}
|
14
14
|
s.description = %q{brings clouds to you}
|
15
15
|
s.email = %q{me@geemus.com}
|
@@ -393,18 +393,18 @@ Gem::Specification.new do |s|
|
|
393
393
|
s.specification_version = 3
|
394
394
|
|
395
395
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
396
|
-
s.add_runtime_dependency(%q<excon>, [">= 0.0.
|
396
|
+
s.add_runtime_dependency(%q<excon>, [">= 0.0.11"])
|
397
397
|
s.add_runtime_dependency(%q<mime-types>, [">= 0"])
|
398
398
|
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
399
399
|
s.add_runtime_dependency(%q<ruby-hmac>, [">= 0"])
|
400
400
|
else
|
401
|
-
s.add_dependency(%q<excon>, [">= 0.0.
|
401
|
+
s.add_dependency(%q<excon>, [">= 0.0.11"])
|
402
402
|
s.add_dependency(%q<mime-types>, [">= 0"])
|
403
403
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
404
404
|
s.add_dependency(%q<ruby-hmac>, [">= 0"])
|
405
405
|
end
|
406
406
|
else
|
407
|
-
s.add_dependency(%q<excon>, [">= 0.0.
|
407
|
+
s.add_dependency(%q<excon>, [">= 0.0.11"])
|
408
408
|
s.add_dependency(%q<mime-types>, [">= 0"])
|
409
409
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
410
410
|
s.add_dependency(%q<ruby-hmac>, [">= 0"])
|
@@ -16,8 +16,6 @@ module Fog
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def instance=(new_instance)
|
19
|
-
requires :public_ip
|
20
|
-
|
21
19
|
if new_instance
|
22
20
|
associate(new_instance)
|
23
21
|
else
|
@@ -41,7 +39,7 @@ module Fog
|
|
41
39
|
@instance = new_instance
|
42
40
|
else
|
43
41
|
@instance = nil
|
44
|
-
@instance_id = new_instance.
|
42
|
+
@instance_id = new_instance.id
|
45
43
|
connection.associate_address(@instance_id, @public_ip)
|
46
44
|
end
|
47
45
|
end
|
@@ -4,15 +4,15 @@ module Fog
|
|
4
4
|
|
5
5
|
class Instance < Fog::Model
|
6
6
|
|
7
|
-
identity :
|
7
|
+
identity :id, 'instanceId'
|
8
8
|
|
9
9
|
attribute :ami_launch_index, 'amiLaunchIndex'
|
10
10
|
attribute :availability_zone, 'availabilityZone'
|
11
11
|
attribute :dns_name, 'dnsName'
|
12
12
|
attribute :group_id, 'groupId'
|
13
13
|
attribute :image_id, 'imageId'
|
14
|
-
attribute :
|
15
|
-
attribute :
|
14
|
+
attribute :state, 'instanceState'
|
15
|
+
attribute :type, 'instanceType'
|
16
16
|
attribute :kernel_id, 'kernelId'
|
17
17
|
attribute :key_name, 'keyName'
|
18
18
|
attribute :launch_time, 'launchTime'
|
@@ -24,15 +24,15 @@ module Fog
|
|
24
24
|
attribute :user_data
|
25
25
|
|
26
26
|
def addresses
|
27
|
-
requires :
|
27
|
+
requires :id
|
28
28
|
|
29
29
|
connection.addresses(:instance => self)
|
30
30
|
end
|
31
31
|
|
32
32
|
def destroy
|
33
|
-
requires :
|
33
|
+
requires :id
|
34
34
|
|
35
|
-
connection.terminate_instances(@
|
35
|
+
connection.terminate_instances(@id)
|
36
36
|
true
|
37
37
|
end
|
38
38
|
|
@@ -71,9 +71,9 @@ module Fog
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def reboot
|
74
|
-
requires :
|
74
|
+
requires :id
|
75
75
|
|
76
|
-
connection.reboot_instances(@
|
76
|
+
connection.reboot_instances(@id)
|
77
77
|
true
|
78
78
|
end
|
79
79
|
|
@@ -87,8 +87,8 @@ module Fog
|
|
87
87
|
if @group_id
|
88
88
|
options['SecurityGroup'] = @group_id
|
89
89
|
end
|
90
|
-
if @
|
91
|
-
options['InstanceType'] = @
|
90
|
+
if @type
|
91
|
+
options['InstanceType'] = @type
|
92
92
|
end
|
93
93
|
if @kernel_id
|
94
94
|
options['KernelId'] = @kernel_id
|
@@ -111,18 +111,18 @@ module Fog
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def volumes
|
114
|
-
requires :
|
114
|
+
requires :id
|
115
115
|
|
116
116
|
connection.volumes(:instance => self)
|
117
117
|
end
|
118
118
|
|
119
119
|
private
|
120
120
|
|
121
|
-
def
|
122
|
-
if
|
123
|
-
@
|
121
|
+
def state=(new_state)
|
122
|
+
if new_state.is_a?(Hash)
|
123
|
+
@state = new_state['name']
|
124
124
|
else
|
125
|
-
@
|
125
|
+
@state = new_state
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
@@ -4,45 +4,45 @@ module Fog
|
|
4
4
|
|
5
5
|
class SecurityGroup < Fog::Model
|
6
6
|
|
7
|
-
identity :
|
7
|
+
identity :name, 'groupName'
|
8
8
|
|
9
|
-
attribute :
|
10
|
-
attribute :ip_permissions,
|
11
|
-
attribute :owner_id,
|
9
|
+
attribute :description, 'groupDescription'
|
10
|
+
attribute :ip_permissions, 'ipPermissions'
|
11
|
+
attribute :owner_id, 'ownerId'
|
12
12
|
|
13
13
|
def authorize_group_and_owner(group, owner)
|
14
|
-
requires :
|
14
|
+
requires :name
|
15
15
|
|
16
16
|
connection.authorize_security_group_ingress(
|
17
|
-
'GroupName' => @
|
17
|
+
'GroupName' => @name,
|
18
18
|
'SourceSecurityGroupName' => group,
|
19
19
|
'SourceSecurityGroupOwnerId' => owner
|
20
20
|
)
|
21
21
|
end
|
22
22
|
|
23
23
|
def authorize_port_range(range, options = {})
|
24
|
-
requires :
|
24
|
+
requires :name
|
25
25
|
|
26
26
|
connection.authorize_security_group_ingress(
|
27
27
|
'CidrIp' => options[:cidr_ip] || '0.0.0.0/0',
|
28
28
|
'FromPort' => range.min,
|
29
|
-
'GroupName' => @
|
29
|
+
'GroupName' => @name,
|
30
30
|
'ToPort' => range.max,
|
31
31
|
'IpProtocol' => options[:ip_protocol] || 'tcp'
|
32
32
|
)
|
33
33
|
end
|
34
34
|
|
35
35
|
def destroy
|
36
|
-
requires :
|
36
|
+
requires :name
|
37
37
|
|
38
|
-
connection.delete_security_group(@
|
38
|
+
connection.delete_security_group(@name)
|
39
39
|
true
|
40
40
|
end
|
41
41
|
|
42
42
|
def save
|
43
|
-
requires :
|
43
|
+
requires :name
|
44
44
|
|
45
|
-
data = connection.create_security_group(@
|
45
|
+
data = connection.create_security_group(@name, @description).body
|
46
46
|
true
|
47
47
|
end
|
48
48
|
|
@@ -4,7 +4,7 @@ module Fog
|
|
4
4
|
|
5
5
|
class Snapshot < Fog::Model
|
6
6
|
|
7
|
-
identity :
|
7
|
+
identity :id, 'snapshotId'
|
8
8
|
|
9
9
|
attribute :progress
|
10
10
|
attribute :start_time, 'startTime'
|
@@ -12,9 +12,9 @@ module Fog
|
|
12
12
|
attribute :volume_id, 'volumeId'
|
13
13
|
|
14
14
|
def destroy
|
15
|
-
requires :
|
15
|
+
requires :id
|
16
16
|
|
17
|
-
connection.delete_snapshot(@
|
17
|
+
connection.delete_snapshot(@id)
|
18
18
|
true
|
19
19
|
end
|
20
20
|
|
@@ -28,7 +28,7 @@ module Fog
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def volume
|
31
|
-
requires :
|
31
|
+
requires :id
|
32
32
|
|
33
33
|
connection.describe_volumes(@volume_id)
|
34
34
|
end
|
@@ -11,7 +11,7 @@ module Fog
|
|
11
11
|
class Snapshots < Fog::Collection
|
12
12
|
|
13
13
|
attribute :snapshot_id
|
14
|
-
attribute :
|
14
|
+
attribute :volume
|
15
15
|
|
16
16
|
model Fog::AWS::EC2::Snapshot
|
17
17
|
|
@@ -32,8 +32,8 @@ module Fog
|
|
32
32
|
:connection => connection
|
33
33
|
}.merge!(snapshot))
|
34
34
|
end
|
35
|
-
if
|
36
|
-
snapshots = snapshots.select {|snapshot| snapshot.volume_id ==
|
35
|
+
if volume
|
36
|
+
snapshots = snapshots.select {|snapshot| snapshot.volume_id == volume.id}
|
37
37
|
end
|
38
38
|
snapshots
|
39
39
|
end
|
@@ -47,11 +47,11 @@ module Fog
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def new(attributes = {})
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
if volume
|
51
|
+
super({ :volume_id => volume.id }.merge!(attributes))
|
52
|
+
else
|
53
|
+
super
|
53
54
|
end
|
54
|
-
snapshot
|
55
55
|
end
|
56
56
|
|
57
57
|
end
|
@@ -4,7 +4,7 @@ module Fog
|
|
4
4
|
|
5
5
|
class Volume < Fog::Model
|
6
6
|
|
7
|
-
identity :
|
7
|
+
identity :id, 'volumeId'
|
8
8
|
|
9
9
|
attribute :attach_time, 'attachTime'
|
10
10
|
attribute :availability_zone, 'availabilityZone'
|
@@ -23,15 +23,13 @@ module Fog
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def destroy
|
26
|
-
requires :
|
26
|
+
requires :id
|
27
27
|
|
28
|
-
connection.delete_volume(@
|
28
|
+
connection.delete_volume(@id)
|
29
29
|
true
|
30
30
|
end
|
31
31
|
|
32
32
|
def instance=(new_instance)
|
33
|
-
requires :volume_id
|
34
|
-
|
35
33
|
if new_instance
|
36
34
|
attach(new_instance)
|
37
35
|
else
|
@@ -40,7 +38,7 @@ module Fog
|
|
40
38
|
end
|
41
39
|
|
42
40
|
def save
|
43
|
-
requires :availability_zone, :size
|
41
|
+
requires :availability_zone, :size
|
44
42
|
|
45
43
|
data = connection.create_volume(@availability_zone, @size, @snapshot_id).body
|
46
44
|
new_attributes = data.reject {|key,value| key == 'requestId'}
|
@@ -52,9 +50,9 @@ module Fog
|
|
52
50
|
end
|
53
51
|
|
54
52
|
def snapshots
|
55
|
-
requires :
|
53
|
+
requires :id
|
56
54
|
|
57
|
-
connection.snapshots(:
|
55
|
+
connection.snapshots(:volume => self)
|
58
56
|
end
|
59
57
|
|
60
58
|
private
|
@@ -65,8 +63,8 @@ module Fog
|
|
65
63
|
@availability_zone = new_instance.availability_zone
|
66
64
|
elsif new_instance
|
67
65
|
@instance = nil
|
68
|
-
@instance_id = new_instance.
|
69
|
-
connection.attach_volume(@instance_id, @
|
66
|
+
@instance_id = new_instance.id
|
67
|
+
connection.attach_volume(@instance_id, @id, @device)
|
70
68
|
end
|
71
69
|
end
|
72
70
|
|
@@ -74,7 +72,7 @@ module Fog
|
|
74
72
|
@instance = nil
|
75
73
|
@instance_id = nil
|
76
74
|
unless new_record?
|
77
|
-
connection.detach_volume(@
|
75
|
+
connection.detach_volume(@id)
|
78
76
|
end
|
79
77
|
end
|
80
78
|
|
@@ -33,7 +33,7 @@ module Fog
|
|
33
33
|
}.merge!(volume))
|
34
34
|
end
|
35
35
|
if instance
|
36
|
-
volumes = volumes.select {|volume| volume.instance_id == instance.
|
36
|
+
volumes = volumes.select {|volume| volume.instance_id == instance.id}
|
37
37
|
end
|
38
38
|
volumes
|
39
39
|
end
|
@@ -47,7 +47,11 @@ module Fog
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def new(attributes = {})
|
50
|
-
|
50
|
+
if instance
|
51
|
+
super({ :instance => instance }.merge!(attributes))
|
52
|
+
else
|
53
|
+
super
|
54
|
+
end
|
51
55
|
end
|
52
56
|
|
53
57
|
end
|
data/lib/fog/model.rb
CHANGED
@@ -33,6 +33,8 @@ module Fog
|
|
33
33
|
Marshal.dump(attributes)
|
34
34
|
end
|
35
35
|
|
36
|
+
attr_accessor :connection
|
37
|
+
|
36
38
|
def attributes
|
37
39
|
attributes = {}
|
38
40
|
for attribute in self.class.attributes
|
@@ -45,14 +47,6 @@ module Fog
|
|
45
47
|
@collection
|
46
48
|
end
|
47
49
|
|
48
|
-
def connection=(new_connection)
|
49
|
-
@connection = new_connection
|
50
|
-
end
|
51
|
-
|
52
|
-
def connection
|
53
|
-
@connection
|
54
|
-
end
|
55
|
-
|
56
50
|
def identity
|
57
51
|
send(self.class.instance_variable_get('@identity'))
|
58
52
|
end
|
@@ -103,6 +97,17 @@ module Fog
|
|
103
97
|
end
|
104
98
|
end
|
105
99
|
|
100
|
+
def wait_for(timeout = 600, &block)
|
101
|
+
start = Time.now
|
102
|
+
until instance_eval(&block)
|
103
|
+
if Time.now - start > timeout
|
104
|
+
break
|
105
|
+
end
|
106
|
+
reload
|
107
|
+
sleep(1)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
106
111
|
private
|
107
112
|
|
108
113
|
def collection=(new_collection)
|
@@ -5,7 +5,7 @@ describe 'Fog::AWS::EC2::Address' do
|
|
5
5
|
describe "#initialize" do
|
6
6
|
|
7
7
|
it "should remap attributes from parser" do
|
8
|
-
address =
|
8
|
+
address = ec2.addresses.new(
|
9
9
|
'instanceId' => 'i-00000000',
|
10
10
|
'publicIp' => '0.0.0.0'
|
11
11
|
)
|
@@ -50,21 +50,11 @@ describe 'Fog::AWS::EC2::Address' do
|
|
50
50
|
@instance.destroy
|
51
51
|
end
|
52
52
|
|
53
|
-
it "should not associate with instance if the address has not been saved" do
|
54
|
-
@address.instance = @instance
|
55
|
-
@address.instance_id.should_not == @instance.instance_id
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should associate with instance when the address is saved" do
|
59
|
-
@address.instance = @instance
|
60
|
-
@address.save.should be_true
|
61
|
-
@address.instance_id.should == @instance.instance_id
|
62
|
-
end
|
63
|
-
|
64
53
|
it "should associate with instance to an already saved address" do
|
65
54
|
@address.save.should be_true
|
55
|
+
@instance.wait_for { state == 'running' }
|
66
56
|
@address.instance = @instance
|
67
|
-
@address.instance_id.should == @instance.
|
57
|
+
@address.instance_id.should == @instance.id
|
68
58
|
end
|
69
59
|
end
|
70
60
|
|
@@ -5,7 +5,7 @@ describe 'Fog::AWS::EC2::Instance' do
|
|
5
5
|
describe "#initialize" do
|
6
6
|
|
7
7
|
it "should remap attributes from parser" do
|
8
|
-
instance =
|
8
|
+
instance = ec2.instances.new({
|
9
9
|
'amiLaunchIndex' => 'ami_launch_index',
|
10
10
|
'dnsName' => 'dns_name',
|
11
11
|
'groupId' => 'group_id',
|
@@ -23,8 +23,8 @@ describe 'Fog::AWS::EC2::Instance' do
|
|
23
23
|
instance.dns_name.should == 'dns_name'
|
24
24
|
instance.group_id.should == 'group_id'
|
25
25
|
instance.image_id.should == 'image_id'
|
26
|
-
instance.
|
27
|
-
instance.
|
26
|
+
instance.id.should == 'instance_id'
|
27
|
+
instance.type.should == 'instance_type'
|
28
28
|
instance.kernel_id.should == 'kernel_id'
|
29
29
|
instance.key_name.should == 'key_name'
|
30
30
|
instance.launch_time.should == 'launch_time'
|
@@ -38,8 +38,9 @@ describe 'Fog::AWS::EC2::Instance' do
|
|
38
38
|
describe "#addresses" do
|
39
39
|
|
40
40
|
it "should return a Fog::AWS::EC2::Addresses" do
|
41
|
-
instance = ec2.instances.
|
41
|
+
instance = ec2.instances.create(:image_id => GENTOO_AMI)
|
42
42
|
instance.addresses.should be_a(Fog::AWS::EC2::Addresses)
|
43
|
+
instance.destroy
|
43
44
|
end
|
44
45
|
|
45
46
|
end
|
@@ -53,12 +54,12 @@ describe 'Fog::AWS::EC2::Instance' do
|
|
53
54
|
|
54
55
|
end
|
55
56
|
|
56
|
-
describe "#
|
57
|
+
describe "#state" do
|
57
58
|
it "should remap values out of hash" do
|
58
59
|
instance = Fog::AWS::EC2::Instance.new({
|
59
60
|
'instanceState' => { 'name' => 'instance_state' },
|
60
61
|
})
|
61
|
-
instance.
|
62
|
+
instance.state.should == 'instance_state'
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
@@ -136,12 +137,12 @@ describe 'Fog::AWS::EC2::Instance' do
|
|
136
137
|
end
|
137
138
|
|
138
139
|
it "should not exist in instances before save" do
|
139
|
-
ec2.instances.get(@instance.
|
140
|
+
ec2.instances.get(@instance.id).should be_nil
|
140
141
|
end
|
141
142
|
|
142
143
|
it "should exist in buckets after save" do
|
143
144
|
@instance.save
|
144
|
-
ec2.instances.get(@instance.
|
145
|
+
ec2.instances.get(@instance.id).should_not be_nil
|
145
146
|
@instance.destroy
|
146
147
|
end
|
147
148
|
|
@@ -150,8 +151,9 @@ describe 'Fog::AWS::EC2::Instance' do
|
|
150
151
|
describe "#volumes" do
|
151
152
|
|
152
153
|
it "should return a Fog::AWS::EC2::Volumes" do
|
153
|
-
instance = ec2.instances.
|
154
|
+
instance = ec2.instances.create(:image_id => GENTOO_AMI)
|
154
155
|
instance.volumes.should be_a(Fog::AWS::EC2::Volumes)
|
156
|
+
instance.destroy
|
155
157
|
end
|
156
158
|
|
157
159
|
end
|
@@ -10,7 +10,7 @@ describe 'Fog::AWS::EC2::Instances' do
|
|
10
10
|
|
11
11
|
it "should include persisted instances" do
|
12
12
|
instance = ec2.instances.create(:image_id => GENTOO_AMI)
|
13
|
-
ec2.instances.get(instance.
|
13
|
+
ec2.instances.get(instance.id).should_not be_nil
|
14
14
|
instance.destroy
|
15
15
|
end
|
16
16
|
|
@@ -31,7 +31,7 @@ describe 'Fog::AWS::EC2::Instances' do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should exist on ec2" do
|
34
|
-
ec2.instances.get(@instance.
|
34
|
+
ec2.instances.get(@instance.id).should_not be_nil
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
@@ -40,7 +40,7 @@ describe 'Fog::AWS::EC2::Instances' do
|
|
40
40
|
|
41
41
|
it "should return a Fog::AWS::EC2::Instance if a matching instance exists" do
|
42
42
|
instance = ec2.instances.create(:image_id => GENTOO_AMI)
|
43
|
-
get = ec2.instances.get(instance.
|
43
|
+
get = ec2.instances.get(instance.id)
|
44
44
|
instance.attributes.should == get.attributes
|
45
45
|
instance.destroy
|
46
46
|
end
|
@@ -5,7 +5,7 @@ describe 'Fog::AWS::EC2::KeyPair' do
|
|
5
5
|
describe "#initialize" do
|
6
6
|
|
7
7
|
it "should remap attributes from parser" do
|
8
|
-
key_pair =
|
8
|
+
key_pair = ec2.key_pairs.new(
|
9
9
|
'keyFingerprint' => 'fingerprint',
|
10
10
|
'keyMaterial' => 'material',
|
11
11
|
'keyName' => 'name'
|
@@ -5,14 +5,14 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
|
|
5
5
|
describe "#initialize" do
|
6
6
|
|
7
7
|
it "should remap attributes from parser" do
|
8
|
-
security_group =
|
8
|
+
security_group = ec2.security_groups.new(
|
9
9
|
'groupDescription' => 'description',
|
10
10
|
'groupName' => 'name',
|
11
11
|
'ipPermissions' => 'permissions',
|
12
12
|
'ownerId' => 'owner'
|
13
13
|
)
|
14
|
-
security_group.
|
15
|
-
security_group.
|
14
|
+
security_group.description.should == 'description'
|
15
|
+
security_group.name.should == 'name'
|
16
16
|
security_group.ip_permissions.should == 'permissions'
|
17
17
|
security_group.owner_id.should == 'owner'
|
18
18
|
end
|
@@ -35,7 +35,7 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
|
|
35
35
|
describe "#destroy" do
|
36
36
|
|
37
37
|
it "should return true if the security_group is deleted" do
|
38
|
-
address = ec2.security_groups.create(:
|
38
|
+
address = ec2.security_groups.create(:description => 'groupdescription', :name => 'keyname')
|
39
39
|
address.destroy.should be_true
|
40
40
|
end
|
41
41
|
|
@@ -44,7 +44,7 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
|
|
44
44
|
describe "#reload" do
|
45
45
|
|
46
46
|
before(:each) do
|
47
|
-
@security_group = ec2.security_groups.create(:
|
47
|
+
@security_group = ec2.security_groups.create(:description => 'groupdescription', :name => 'keyname')
|
48
48
|
@reloaded = @security_group.reload
|
49
49
|
end
|
50
50
|
|
@@ -65,7 +65,7 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
|
|
65
65
|
describe "#save" do
|
66
66
|
|
67
67
|
before(:each) do
|
68
|
-
@security_group = ec2.security_groups.new(:
|
68
|
+
@security_group = ec2.security_groups.new(:description => 'groupdescription', :name => 'keyname')
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should return true when it succeeds" do
|
@@ -74,12 +74,12 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should not exist in security_groups before save" do
|
77
|
-
ec2.security_groups.get(@security_group.
|
77
|
+
ec2.security_groups.get(@security_group.name).should be_nil
|
78
78
|
end
|
79
79
|
|
80
80
|
it "should exist in buckets after save" do
|
81
81
|
@security_group.save
|
82
|
-
ec2.security_groups.get(@security_group.
|
82
|
+
ec2.security_groups.get(@security_group.name).should_not be_nil
|
83
83
|
@security_group.destroy
|
84
84
|
end
|
85
85
|
|
@@ -9,8 +9,8 @@ describe 'Fog::AWS::EC2::SecurityGroups' do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should include persisted security_groups" do
|
12
|
-
security_group = ec2.security_groups.create(:
|
13
|
-
ec2.security_groups.get(security_group.
|
12
|
+
security_group = ec2.security_groups.create(:description => 'groupdescription', :name => 'keyname')
|
13
|
+
ec2.security_groups.get(security_group.name).should_not be_nil
|
14
14
|
security_group.destroy
|
15
15
|
end
|
16
16
|
|
@@ -19,7 +19,7 @@ describe 'Fog::AWS::EC2::SecurityGroups' do
|
|
19
19
|
describe "#create" do
|
20
20
|
|
21
21
|
before(:each) do
|
22
|
-
@security_group = ec2.security_groups.create(:
|
22
|
+
@security_group = ec2.security_groups.create(:description => 'groupdescription', :name => 'keyname')
|
23
23
|
end
|
24
24
|
|
25
25
|
after(:each) do
|
@@ -31,7 +31,7 @@ describe 'Fog::AWS::EC2::SecurityGroups' do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should exist on ec2" do
|
34
|
-
ec2.security_groups.get(@security_group.
|
34
|
+
ec2.security_groups.get(@security_group.name).should_not be_nil
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
@@ -39,10 +39,10 @@ describe 'Fog::AWS::EC2::SecurityGroups' do
|
|
39
39
|
describe "#get" do
|
40
40
|
|
41
41
|
it "should return a Fog::AWS::EC2::SecurityGroup if a matching security_group exists" do
|
42
|
-
security_group = ec2.security_groups.create(:
|
43
|
-
get = ec2.security_groups.get(security_group.
|
42
|
+
security_group = ec2.security_groups.create(:description => 'groupdescription', :name => 'keyname')
|
43
|
+
get = ec2.security_groups.get(security_group.name)
|
44
44
|
security_group.attributes[:fingerprint].should == get.attributes[:fingerprint]
|
45
|
-
security_group.attributes[:
|
45
|
+
security_group.attributes[:name].should == get.attributes[:name]
|
46
46
|
security_group.destroy
|
47
47
|
end
|
48
48
|
|
@@ -55,7 +55,7 @@ describe 'Fog::AWS::EC2::SecurityGroups' do
|
|
55
55
|
describe "#new" do
|
56
56
|
|
57
57
|
it "should return a Fog::AWS::EC2::SecurityGroup" do
|
58
|
-
ec2.security_groups.new(:
|
58
|
+
ec2.security_groups.new(:description => 'groupdescription', :name => 'keyname').should be_a(Fog::AWS::EC2::SecurityGroup)
|
59
59
|
end
|
60
60
|
|
61
61
|
end
|
@@ -5,12 +5,12 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
5
5
|
describe "#initialize" do
|
6
6
|
|
7
7
|
it "should remap attributes from parser" do
|
8
|
-
snapshot =
|
8
|
+
snapshot = ec2.snapshots.new(
|
9
9
|
'snapshotId' => 'snap-00000000',
|
10
10
|
'startTime' => 'now',
|
11
11
|
'volumeId' => 'vol-00000000'
|
12
12
|
)
|
13
|
-
snapshot.
|
13
|
+
snapshot.id.should == 'snap-00000000'
|
14
14
|
snapshot.start_time.should == 'now'
|
15
15
|
snapshot.volume_id.should == 'vol-00000000'
|
16
16
|
end
|
@@ -81,12 +81,12 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
81
81
|
end
|
82
82
|
|
83
83
|
it "should not exist in addresses before save" do
|
84
|
-
ec2.snapshots.get(@snapshot.
|
84
|
+
ec2.snapshots.get(@snapshot.id).should be_nil
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should exist in buckets after save" do
|
88
88
|
@snapshot.save
|
89
|
-
ec2.snapshots.get(@snapshot.
|
89
|
+
ec2.snapshots.get(@snapshot.id).should_not be_nil
|
90
90
|
@snapshot.destroy
|
91
91
|
end
|
92
92
|
|
@@ -11,16 +11,16 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
11
11
|
it "should include persisted snapshots" do
|
12
12
|
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
13
13
|
snapshot = volume.snapshots.create
|
14
|
-
ec2.snapshots.all.map {|snapshot| snapshot.
|
14
|
+
ec2.snapshots.all.map {|snapshot| snapshot.id}.should include(snapshot.id)
|
15
15
|
snapshot.destroy
|
16
16
|
volume.destroy
|
17
17
|
end
|
18
18
|
|
19
|
-
it "should limit snapshots by
|
19
|
+
it "should limit snapshots by volume if present" do
|
20
20
|
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
21
21
|
other_volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
22
22
|
snapshot = volume.snapshots.create
|
23
|
-
other_volume.snapshots.all.map {|snapshot| snapshot.
|
23
|
+
other_volume.snapshots.all.map {|snapshot| snapshot.id}.should_not include(snapshot.id)
|
24
24
|
snapshot.destroy
|
25
25
|
other_volume.destroy
|
26
26
|
volume.destroy
|
@@ -45,7 +45,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should exist on ec2" do
|
48
|
-
ec2.snapshots.get(@snapshot.
|
48
|
+
ec2.snapshots.get(@snapshot.id).should_not be_nil
|
49
49
|
end
|
50
50
|
|
51
51
|
end
|
@@ -55,8 +55,8 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
55
55
|
it "should return a Fog::AWS::EC2::Snapshot if a matching snapshot exists" do
|
56
56
|
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
57
57
|
snapshot = volume.snapshots.create
|
58
|
-
get = ec2.snapshots.get(snapshot.
|
59
|
-
snapshot.attributes.reject {|key, value| [
|
58
|
+
get = ec2.snapshots.get(snapshot.id)
|
59
|
+
snapshot.attributes.reject {|key, value| [:progress, :status].include?(key)}.should == get.attributes.reject {|key, value| [:progress, :status].include?(key)}
|
60
60
|
snapshot.destroy
|
61
61
|
end
|
62
62
|
|
@@ -5,8 +5,8 @@ describe 'Fog::AWS::EC2::Volume' do
|
|
5
5
|
describe "#initialize" do
|
6
6
|
|
7
7
|
it "should remap attributes from parser" do
|
8
|
-
volume =
|
9
|
-
'attachTime'
|
8
|
+
volume = ec2.volumes.new(
|
9
|
+
'attachTime' => 'now',
|
10
10
|
'availabilityZone' => 'us-east-1a',
|
11
11
|
'createTime' => 'recently',
|
12
12
|
'instanceId' => 'i-00000000',
|
@@ -18,7 +18,7 @@ describe 'Fog::AWS::EC2::Volume' do
|
|
18
18
|
volume.create_time.should == 'recently'
|
19
19
|
volume.instance_id.should == 'i-00000000'
|
20
20
|
volume.snapshot_id.should == 'snap-00000000'
|
21
|
-
volume.
|
21
|
+
volume.id.should == 'vol-00000000'
|
22
22
|
end
|
23
23
|
|
24
24
|
end
|
@@ -39,7 +39,7 @@ describe 'Fog::AWS::EC2::Volume' do
|
|
39
39
|
describe "#destroy" do
|
40
40
|
|
41
41
|
it "should return true if the volume is deleted" do
|
42
|
-
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
42
|
+
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
|
43
43
|
volume.destroy.should be_true
|
44
44
|
end
|
45
45
|
|
@@ -48,26 +48,23 @@ describe 'Fog::AWS::EC2::Volume' do
|
|
48
48
|
describe "#instance=" do
|
49
49
|
before(:each) do
|
50
50
|
@instance = ec2.instances.create(:image_id => GENTOO_AMI)
|
51
|
-
@volume = ec2.volumes.new(:availability_zone => @instance.availability_zone, :size => 1, :device => 'dev/sdz1')
|
52
|
-
|
53
|
-
@instance.reload
|
54
|
-
end
|
55
|
-
while @volume.status == 'creating'
|
56
|
-
@volume.reload
|
57
|
-
end
|
51
|
+
@volume = ec2.volumes.new(:availability_zone => @instance.availability_zone, :size => 1, :device => '/dev/sdz1')
|
52
|
+
@instance.wait_for { state == 'running' }
|
58
53
|
end
|
59
54
|
|
60
55
|
after(:each) do
|
61
56
|
@instance.destroy
|
62
|
-
if @volume.
|
57
|
+
if @volume.id
|
58
|
+
@volume.wait_for { status == 'attached' }
|
63
59
|
@volume.instance = nil
|
60
|
+
@volume.wait_for { status == 'available' }
|
64
61
|
@volume.destroy
|
65
62
|
end
|
66
63
|
end
|
67
64
|
|
68
65
|
it "should not attach to instance if the volume has not been saved" do
|
69
66
|
@volume.instance = @instance
|
70
|
-
@volume.instance_id.should_not == @instance.
|
67
|
+
@volume.instance_id.should_not == @instance.id
|
71
68
|
end
|
72
69
|
|
73
70
|
it "should change the availability_zone if the volume has not been saved" do
|
@@ -78,13 +75,13 @@ describe 'Fog::AWS::EC2::Volume' do
|
|
78
75
|
it "should attach to instance when the volume is saved" do
|
79
76
|
@volume.instance = @instance
|
80
77
|
@volume.save.should be_true
|
81
|
-
@volume.instance_id.should == @instance.
|
78
|
+
@volume.instance_id.should == @instance.id
|
82
79
|
end
|
83
80
|
|
84
81
|
it "should attach to instance to an already saved volume" do
|
85
82
|
@volume.save.should be_true
|
86
83
|
@volume.instance = @instance
|
87
|
-
@volume.instance_id.should == @instance.
|
84
|
+
@volume.instance_id.should == @instance.id
|
88
85
|
end
|
89
86
|
|
90
87
|
it "should not change the availability_zone if the volume has been saved" do
|
@@ -97,7 +94,7 @@ describe 'Fog::AWS::EC2::Volume' do
|
|
97
94
|
describe "#reload" do
|
98
95
|
|
99
96
|
before(:each) do
|
100
|
-
@volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
97
|
+
@volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
|
101
98
|
@reloaded = @volume.reload
|
102
99
|
end
|
103
100
|
|
@@ -118,7 +115,7 @@ describe 'Fog::AWS::EC2::Volume' do
|
|
118
115
|
describe "#save" do
|
119
116
|
|
120
117
|
before(:each) do
|
121
|
-
@volume = ec2.volumes.new(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
118
|
+
@volume = ec2.volumes.new(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
|
122
119
|
end
|
123
120
|
|
124
121
|
it "should return true when it succeeds" do
|
@@ -127,12 +124,12 @@ describe 'Fog::AWS::EC2::Volume' do
|
|
127
124
|
end
|
128
125
|
|
129
126
|
it "should not exist in volumes before save" do
|
130
|
-
ec2.volumes.get(@volume.
|
127
|
+
ec2.volumes.get(@volume.id).should be_nil
|
131
128
|
end
|
132
129
|
|
133
130
|
it "should exist in buckets after save" do
|
134
131
|
@volume.save
|
135
|
-
ec2.volumes.get(@volume.
|
132
|
+
ec2.volumes.get(@volume.id).should_not be_nil
|
136
133
|
@volume.destroy
|
137
134
|
end
|
138
135
|
|
@@ -10,7 +10,7 @@ describe 'Fog::AWS::EC2::Volumes' do
|
|
10
10
|
|
11
11
|
it "should include persisted volumes" do
|
12
12
|
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
13
|
-
ec2.volumes.get(volume.
|
13
|
+
ec2.volumes.get(volume.id).should_not be_nil
|
14
14
|
volume.destroy
|
15
15
|
end
|
16
16
|
|
@@ -31,7 +31,7 @@ describe 'Fog::AWS::EC2::Volumes' do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should exist on ec2" do
|
34
|
-
ec2.volumes.get(@volume.
|
34
|
+
ec2.volumes.get(@volume.id).should_not be_nil
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
@@ -40,8 +40,8 @@ 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 = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
43
|
-
get = ec2.volumes.get(volume.
|
44
|
-
volume.attributes.reject { |key, value|
|
43
|
+
get = ec2.volumes.get(volume.id)
|
44
|
+
volume.attributes.reject { |key, value| [:device, :status].include?(key) }.should == get.attributes.reject { |key, value| [:device, :status].include?(key) }
|
45
45
|
volume.destroy
|
46
46
|
end
|
47
47
|
|
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.
|
4
|
+
version: 0.0.33
|
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: 2009-12-
|
12
|
+
date: 2009-12-08 00:00:00 -08:00
|
13
13
|
default_executable: fog
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.
|
23
|
+
version: 0.0.11
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mime-types
|