Return-Path: Delivered-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Received: (qmail 42059 invoked from network); 21 Jan 2011 13:44:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Jan 2011 13:44:19 -0000 Received: (qmail 30016 invoked by uid 500); 21 Jan 2011 13:44:19 -0000 Delivered-To: apmail-incubator-deltacloud-dev-archive@incubator.apache.org Received: (qmail 29920 invoked by uid 500); 21 Jan 2011 13:44:18 -0000 Mailing-List: contact deltacloud-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: deltacloud-dev@incubator.apache.org Delivered-To: mailing list deltacloud-dev@incubator.apache.org Received: (qmail 29911 invoked by uid 99); 21 Jan 2011 13:44:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jan 2011 13:44:17 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=10.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of bbrownin@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jan 2011 13:44:09 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0LDhm1Q008964 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 21 Jan 2011 08:43:48 -0500 Received: from localhost.localdomain (vpn-9-158.rdu.redhat.com [10.11.9.158]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p0LDhUaw008145; Fri, 21 Jan 2011 08:43:47 -0500 From: Ben Browning To: deltacloud-dev@incubator.apache.org Cc: Ben Browning Subject: [PATCH] Don't reload object state after destroying Date: Fri, 21 Jan 2011 08:43:18 -0500 Message-Id: <1295617398-75867-2-git-send-email-bbrownin@redhat.com> In-Reply-To: <1295617398-75867-1-git-send-email-bbrownin@redhat.com> References: <1295617398-75867-1-git-send-email-bbrownin@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Virus-Checked: Checked by ClamAV on apache.org --- 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