fog 0.0.32 → 0.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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')
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.32
1
+ 0.0.33
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fog}
8
- s.version = "0.0.32"
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-03}
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.10"])
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.10"])
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.10"])
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.instance_id
42
+ @instance_id = new_instance.id
45
43
  connection.associate_address(@instance_id, @public_ip)
46
44
  end
47
45
  end
@@ -44,7 +44,11 @@ module Fog
44
44
  end
45
45
 
46
46
  def new(attributes = {})
47
- super({ :instance => instance }.merge!(attributes))
47
+ if instance
48
+ super({ :instance => instance }.merge!(attributes))
49
+ else
50
+ super(attributes)
51
+ end
48
52
  end
49
53
 
50
54
  end
@@ -4,15 +4,15 @@ module Fog
4
4
 
5
5
  class Instance < Fog::Model
6
6
 
7
- identity :instance_id, 'instanceId'
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 :instance_state, 'instanceState'
15
- attribute :instance_type, 'instanceType'
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 :instance_id
27
+ requires :id
28
28
 
29
29
  connection.addresses(:instance => self)
30
30
  end
31
31
 
32
32
  def destroy
33
- requires :instance_id
33
+ requires :id
34
34
 
35
- connection.terminate_instances(@instance_id)
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 :instance_id
74
+ requires :id
75
75
 
76
- connection.reboot_instances(@instance_id)
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 @instance_type
91
- options['InstanceType'] = @instance_type
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 :instance_id
114
+ requires :id
115
115
 
116
116
  connection.volumes(:instance => self)
117
117
  end
118
118
 
119
119
  private
120
120
 
121
- def instance_state=(new_instance_state)
122
- if new_instance_state.is_a?(Hash)
123
- @instance_state = new_instance_state['name']
121
+ def state=(new_state)
122
+ if new_state.is_a?(Hash)
123
+ @state = new_state['name']
124
124
  else
125
- @instance_state = new_instance_state
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 :group_name, 'groupName'
7
+ identity :name, 'groupName'
8
8
 
9
- attribute :group_description, 'groupDescription'
10
- attribute :ip_permissions, 'ipPermissions'
11
- attribute :owner_id, 'ownerId'
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 :group_name
14
+ requires :name
15
15
 
16
16
  connection.authorize_security_group_ingress(
17
- 'GroupName' => @group_name,
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 :group_name
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' => @group_name,
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 :group_name
36
+ requires :name
37
37
 
38
- connection.delete_security_group(@group_name)
38
+ connection.delete_security_group(@name)
39
39
  true
40
40
  end
41
41
 
42
42
  def save
43
- requires :group_name
43
+ requires :name
44
44
 
45
- data = connection.create_security_group(@group_name, @group_description).body
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 :snapshot_id, 'snapshotId'
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 :snapshot_id
15
+ requires :id
16
16
 
17
- connection.delete_snapshot(@snapshot_id)
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 :snapshot_id
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 :volume_id
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 volume_id
36
- snapshots = snapshots.select {|snapshot| snapshot.volume_id == 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
- snapshot = super(attributes)
51
- if volume_id
52
- snapshot.volume_id = volume_id
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 :volume_id, 'volumeId'
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 :volume_id
26
+ requires :id
27
27
 
28
- connection.delete_volume(@volume_id)
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, :snapshot_id
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 :volume_id
53
+ requires :id
56
54
 
57
- connection.snapshots(:volume_id => @volume_id)
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.instance_id
69
- connection.attach_volume(@instance_id, @volume_id, @device)
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(@volume_id)
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.instance_id}
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
- super({ :instance => instance }.merge!(attributes))
50
+ if instance
51
+ super({ :instance => instance }.merge!(attributes))
52
+ else
53
+ super
54
+ end
51
55
  end
52
56
 
53
57
  end
@@ -46,6 +46,7 @@ unless Fog.mocking?
46
46
  :expects => 200,
47
47
  :headers => {},
48
48
  :host => "#{bucket_name}.#{@host}",
49
+ :idempotent => true,
49
50
  :method => 'GET',
50
51
  :parser => Fog::Parsers::AWS::S3::GetBucket.new,
51
52
  :query => query
@@ -18,6 +18,7 @@ unless Fog.mocking?
18
18
  :expects => 200,
19
19
  :headers => {},
20
20
  :host => "#{bucket_name}.#{@host}",
21
+ :idempotent => true,
21
22
  :method => 'GET',
22
23
  :parser => Fog::Parsers::AWS::S3::GetBucketLocation.new,
23
24
  :query => 'location'
@@ -38,6 +38,7 @@ unless Fog.mocking?
38
38
  :expects => 200,
39
39
  :headers => headers,
40
40
  :host => "#{bucket_name}.#{@host}",
41
+ :idempotent => true,
41
42
  :method => 'GET',
42
43
  :path => CGI.escape(object_name),
43
44
  :block => block
@@ -18,6 +18,7 @@ unless Fog.mocking?
18
18
  :expects => 200,
19
19
  :headers => {},
20
20
  :host => "#{bucket_name}.#{@host}",
21
+ :idempotent => true,
21
22
  :method => 'GET',
22
23
  :parser => Fog::Parsers::AWS::S3::GetRequestPayment.new,
23
24
  :query => 'requestPayment'
@@ -20,6 +20,7 @@ unless Fog.mocking?
20
20
  :expects => 200,
21
21
  :headers => {},
22
22
  :host => @host,
23
+ :idempotent => true,
23
24
  :method => 'GET',
24
25
  :parser => Fog::Parsers::AWS::S3::GetService.new,
25
26
  :url => @host
@@ -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 = Fog::AWS::EC2::Address.new(
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.instance_id
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 = Fog::AWS::EC2::Instance.new({
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.instance_id.should == 'instance_id'
27
- instance.instance_type.should == 'instance_type'
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.new
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 "#instance_state" do
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.instance_state.should == 'instance_state'
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.instance_id).should be_nil
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.instance_id).should_not be_nil
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.new
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.instance_id).should_not be_nil
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.instance_id).should_not be_nil
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.instance_id)
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 = Fog::AWS::EC2::KeyPair.new(
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 = Fog::AWS::EC2::SecurityGroup.new(
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.group_description.should == 'description'
15
- security_group.group_name.should == 'name'
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(:group_description => 'groupdescription', :group_name => 'keyname')
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(:group_description => 'groupdescription', :group_name => 'keyname')
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(:group_description => 'groupdescription', :group_name => 'keyname')
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.group_name).should be_nil
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.group_name).should_not be_nil
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(:group_description => 'groupdescription', :group_name => 'keyname')
13
- ec2.security_groups.get(security_group.group_name).should_not be_nil
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(:group_description => 'groupdescription', :group_name => 'keyname')
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.group_name).should_not be_nil
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(:group_description => 'groupdescription', :group_name => 'keyname')
43
- get = ec2.security_groups.get(security_group.group_name)
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[:group_name].should == get.attributes[:group_name]
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(:group_description => 'groupdescription', :group_name => 'keyname').should be_a(Fog::AWS::EC2::SecurityGroup)
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 = Fog::AWS::EC2::Snapshot.new(
8
+ snapshot = ec2.snapshots.new(
9
9
  'snapshotId' => 'snap-00000000',
10
10
  'startTime' => 'now',
11
11
  'volumeId' => 'vol-00000000'
12
12
  )
13
- snapshot.snapshot_id.should == 'snap-00000000'
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.snapshot_id).should be_nil
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.snapshot_id).should_not be_nil
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.snapshot_id}.should include(snapshot.snapshot_id)
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 volume_id if present" do
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.snapshot_id}.should_not include(snapshot.snapshot_id)
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.snapshot_id).should_not be_nil
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.snapshot_id)
59
- snapshot.attributes.reject {|key, value| ['progress', 'status'].include?(key)}.should == get.attributes.reject {|key, value| ['progress', 'status'].include?(key)}
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 = Fog::AWS::EC2::Volume.new(
9
- 'attachTime' => 'now',
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.volume_id.should == 'vol-00000000'
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
- while @instance.instance_state == 'pending'
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.volume_id
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.instance_id
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.instance_id
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.instance_id
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.volume_id).should be_nil
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.volume_id).should_not be_nil
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.volume_id).should_not be_nil
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.volume_id).should_not be_nil
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.volume_id)
44
- volume.attributes.reject { |key, value| key == :device }.should == get.attributes.reject { |key, value| key == :device }
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.32
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-03 00:00:00 -08:00
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.10
23
+ version: 0.0.11
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mime-types