fog 0.2.22 → 0.2.23

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.2.22'
11
- s.date = '2010-08-01'
10
+ s.version = '0.2.23'
11
+ s.date = '2010-08-16'
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
@@ -41,7 +41,7 @@ require 'fog/vcloud'
41
41
  module Fog
42
42
 
43
43
  unless const_defined?(:VERSION)
44
- VERSION = '0.2.22'
44
+ VERSION = '0.2.23'
45
45
  end
46
46
 
47
47
  module Mock
@@ -55,10 +55,10 @@ module Fog
55
55
  when :time
56
56
  class_eval <<-EOS, __FILE__, __LINE__
57
57
  def #{name}=(new_#{name})
58
- if !new_#{name}.is_a?(Time)
59
- @#{name} = Time.parse(new_#{name})
60
- else
58
+ if new_#{name}.nil? || new_#{name}.is_a?(Time)
61
59
  @#{name} = new_#{name}
60
+ else
61
+ @#{name} = Time.parse(new_#{name})
62
62
  end
63
63
  end
64
64
  EOS
@@ -29,6 +29,10 @@ module Fog
29
29
  def delete_volume(volume_id)
30
30
  response = Excon::Response.new
31
31
  if volume = @data[:volumes][volume_id]
32
+ if volume["attachmentSet"].any?
33
+ attach = volume["attachmentSet"].first
34
+ raise Fog::AWS::EC2::Error.new("Client.VolumeInUse => Volume #{volume_id} is currently attached to #{attach["instanceId"]}")
35
+ end
32
36
  @data[:deleted_at][volume_id] = Time.now
33
37
  volume['status'] = 'deleting'
34
38
  response.status = 200
@@ -14,6 +14,7 @@ module Fog
14
14
  attribute :owner, :aliases => :Owner
15
15
  attribute :start_time, :aliases => :startTime, :type => :time
16
16
  attribute :end_time, :aliases => :endTime, :type => :time
17
+ attribute :error, :aliases => :Error
17
18
 
18
19
  end
19
20
  end
@@ -43,6 +43,14 @@ describe 'Fog::AWS::EC2::Volume' do
43
43
  volume.destroy.should be_true
44
44
  end
45
45
 
46
+ it 'should fail if the volume is attached to an instance' do
47
+ server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI)
48
+ server.wait_for { ready? }
49
+ volume = AWS[:ec2].volumes.create(:availability_zone => server.availability_zone, :size => 1, :device => '/dev/sdz1')
50
+ volume.server = server
51
+ lambda { volume.destroy }.should raise_error
52
+ end
53
+
46
54
  end
47
55
 
48
56
  describe "#server=" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 22
9
- version: 0.2.22
8
+ - 23
9
+ version: 0.2.23
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-08-01 00:00:00 -07:00
17
+ date: 2010-08-16 00:00:00 -07:00
18
18
  default_executable: fog
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency