deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik <mfoj...@redhat.com>
Subject Re: Fixing volume find to return [] in case the array is empty
Date Fri, 19 Oct 2012 09:01:27 GMT
On 10/18/2012 12:28 PM, Oved Ourfali wrote:
> ---
>   server/lib/cimi/models/volume.rb | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/server/lib/cimi/models/volume.rb b/server/lib/cimi/models/volume.rb
> index 8d32c66..8a60ae8 100644
> --- a/server/lib/cimi/models/volume.rb
> +++ b/server/lib/cimi/models/volume.rb
> @@ -40,7 +40,7 @@ class CIMI::Model::Volume < CIMI::Model::Base
>       opts = ( id == :all ) ? {} : { :id => id }
>       volumes = context.driver.storage_volumes(context.credentials, opts)
>       volumes.collect!{ |volume| from_storage_volume(volume, context) }
> -    return volumes.first unless volumes.length > 1
> +    return volumes.first unless volumes.length > 1 || volumes.length == 0
>       return volumes
>     end
>
>

ACK.

-- 

Michal Fojtik <mfojtik@redhat.com>
Deltacloud API, CloudForms

Mime
View raw message