You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Oved Ourfali <oo...@redhat.com> on 2012/10/18 12:28:25 UTC
Fixing volume find to return [] in case the array is empty
---
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
--
1.7.11.2
Re: Fixing volume find to return [] in case the array is empty
Posted by Michal Fojtik <mf...@redhat.com>.
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 <mf...@redhat.com>
Deltacloud API, CloudForms