You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by ma...@redhat.com on 2011/07/28 21:55:05 UTC

EC2 destroy_instance typo

minor typo in ec2 driver destroy_instance. No matter which instance you stopped the method always returned the details of first instance in instances list,

marios

Re: [PATCH] Fix typo in EC2 stop instance. No matter which instance you stopped you would always get the details of the first intance in the list returned.

Posted by David Lutterkort <lu...@redhat.com>.
On Thu, 2011-07-28 at 22:55 +0300, marios@redhat.com wrote:
> From: marios <ma...@redhat.com>

ACK. This typo also affects reboot_instances.

> diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> index 67a4de4..c73c4cd 100644
> --- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> +++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> @@ -241,7 +241,7 @@ module Deltacloud
>          def destroy_instance(credentials, instance_id)
>            ec2 = new_client(credentials)
>            if ec2.terminate_instances([instance_id])
> -            instance(credentials, instance_id)
> +            instance(credentials, {:id=>instance_id})

You can leave the curly braces off, i.e. 'instance(credentials, :id =>
instance)' (that's what the rest of the code does)

David



[PATCH] Fix typo in EC2 stop instance. No matter which instance you stopped you would always get the details of the first intance in the list returned.

Posted by ma...@redhat.com.
From: marios <ma...@redhat.com>


Signed-off-by: marios <ma...@redhat.com>
---
 server/lib/deltacloud/drivers/ec2/ec2_driver.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index 67a4de4..c73c4cd 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -241,7 +241,7 @@ module Deltacloud
         def destroy_instance(credentials, instance_id)
           ec2 = new_client(credentials)
           if ec2.terminate_instances([instance_id])
-            instance(credentials, instance_id)
+            instance(credentials, {:id=>instance_id})
           else
             raise Deltacloud::BackendError.new(500, "Instance", "Instance cannot be terminated", "")
           end
-- 
1.7.3.4