deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronelle Landy <rla...@redhat.com>
Subject Re: [PATCH core 2/2] EC2: Fix storage_volumes not return exception on unknown id
Date Mon, 13 Aug 2012 14:35:52 GMT
QE ACK ..

curl -X POST --user "un:pw" "http://<server>:3005/api/storage_snapshots?format=xml"
Required parameter 'volume_id' not found in [format]
-----------------
> From: mfojtik@redhat.com
> To: dev@deltacloud.apache.org
> Sent: Monday, August 13, 2012 9:31:32 AM
> Subject: [PATCH core 2/2] EC2: Fix storage_volumes not return exception on unknown id
> 
> From: Michal Fojtik <mfojtik@redhat.com>
> 
> * When non-exist storage_volume id was used, the storage_volumes
>   returned exception instead of empty arr.
> 
> Signed-off-by: Michal fojtik <mfojtik@redhat.com>
> ---
>  server/lib/deltacloud/drivers/ec2/ec2_driver.rb |   10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> index 79dd9d2..551bed9 100644
> --- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> +++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> @@ -627,11 +627,19 @@ module Deltacloud
>  
>          def storage_snapshots(credentials, opts={})
>            ec2 = new_client(credentials)
> -          snapshot_list = (opts and opts[:id]) ? [opts[:id]] : []
> +          snapshot_list = opts[:id] ? [opts[:id]] : []
>            safely do
> +            begin
>              ec2.describe_snapshots(snapshot_list).collect do
>              |snapshot|
>                convert_snapshot(snapshot)
>              end
> +            rescue => e
> +              if e.message =~ /NotFound/
> +                []
> +              else
> +                raise e
> +              end
> +            end
>            end
>          end
>  
> --
> 1.7.10.2
> 
> 

Mime
View raw message