You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Ben Browning <bb...@redhat.com> on 2011/01/21 14:43:18 UTC
[PATCH] Don't reload object state after destroying
---
client/lib/base_object.rb | 3 ++-
client/specs/instances_spec.rb | 12 ++++++++++++
2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/client/lib/base_object.rb b/client/lib/base_object.rb
index 93c35cc..0c353c7 100644
--- a/client/lib/base_object.rb
+++ b/client/lib/base_object.rb
@@ -225,7 +225,8 @@ module DeltaCloud
end
def action_trigger(action)
- # Refresh object state after action
+ # Refresh object state after action unless the object was destroyed
+ return if action.to_s == "destroy"
@new_state_object = @client.send(self.base_name, self.id)
@state = @new_state_object.state
self.update_actions!
diff --git a/client/specs/instances_spec.rb b/client/specs/instances_spec.rb
index b976d86..c309c24 100644
--- a/client/specs/instances_spec.rb
+++ b/client/specs/instances_spec.rb
@@ -190,5 +190,17 @@ describe "instances" do
instance.state.should eql( "RUNNING" )
end
end
+
+ it "should not throw exception when destroying an instance" do
+ DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+ instance = client.create_instance( 'img1',
+ :name=>'TestDestroyInstance',
+ :hardware_profile => 'm1-xlarge' )
+ instance.stop!
+ lambda {
+ instance.destroy!
+ }.should_not raise_error
+ end
+ end
end
end
--
1.7.2.1